fix: don't fail when windows cilium script not present - #9192
fix: don't fail when windows cilium script not present#9192Tim Wright (timmy-wright) wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the Windows CSE Windows Cilium Networking installer wrapper to avoid throwing/terminating when the expected install.ps1 script is not present, by guarding the invocation with a Test-Path check and logging instead.
Changes:
- Add an existence check before invoking the Windows Cilium Networking install script.
- Log a message (instead of failing) when the install script cannot be found.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| $wcnInstallScript = $global:WindowsCiliumInstallPath | Join-Path -ChildPath 'scripts' | Join-Path -ChildPath 'install' | Join-Path -ChildPath 'install.ps1' | ||
| & $wcnInstallScript @Arguments | ||
| if (Test-Path -Path $wcnInstallScript -PathType Leaf) { | ||
| & $wcnInstallScript @Arguments | ||
| } else { | ||
| Write-Log "Windows Cilium Networking installation script could not be found: $wcnInstallScript" | ||
| } |
| if (Test-Path -Path $wcnInstallScript -PathType Leaf) { | ||
| & $wcnInstallScript @Arguments | ||
| } else { | ||
| Write-Log "Windows Cilium Networking installation script could not be found: $wcnInstallScript" | ||
| } |
Windows Unit Test Results 3 files 12 suites 47s ⏱️ Results for commit 41534ad. ♻️ This comment has been updated with latest results. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
Suppressed comments (2)
staging/cse/windows/windowsciliumnetworkingfunc.ps1:63
Invoke-WindowsCiliumNetworkingInstallScriptmay now skip execution when the install script is missing, butEnable-WindowsCiliumNetworkingstill logs "installation completed successfully" unconditionally. This is misleading during debugging because the install can be a no-op without any failure.
Write-Log "Windows Cilium Networking installation completed successfully$(if ($isRebootNeeded) { ' (restart required)' })."
if ($isRebootNeeded) {
$global:RebootNeeded = $true
}
} catch {
staging/cse/windows/windowsciliumnetworkingfunc.ps1:102
- The success-path log message says "Expecting windows cilium install script" even though the file was already found, and the capitalization is inconsistent with other logs. Consider logging that the script is being executed, and make the missing-script message explicitly say it is being skipped.
if (Test-Path -Path $wcnInstallScript -PathType Leaf) {
Write-Log "Expecting windows cilium install script at: $wcnInstallScript"
& $wcnInstallScript @Arguments
} else {
Write-Log "Windows Cilium Networking installation script could not be found: $wcnInstallScript"
What this PR does / why we need it:
Which issue(s) this PR fixes:
Fixes #