Skip to content

Commit

Permalink
Merge pull request #6957 from coutinhop/auto-pick-of-#6952-upstream-r…
Browse files Browse the repository at this point in the history
…elease-v3.24

[release-v3.24] Auto pick #6952: Add flag to calico windows uninstall script and pass it from
  • Loading branch information
mgleung authored Nov 7, 2022
2 parents 95659e1 + a3a36eb commit aadb205
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions node/windows-packaging/CalicoWindows/uninstall-calico.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
# limitations under the License.
param
(
[bool][parameter(Mandatory=$false)]$ExceptUpgradeService = $false
[bool][parameter(Mandatory=$false)]$ExceptUpgradeService = $false,
[bool][parameter(Mandatory=$false)]$CleanupForHostProcessInstall = $false
)

ipmo "$PSScriptRoot\libs\calico\calico.psm1" -Force
Expand All @@ -25,8 +26,10 @@ Test-CalicoConfiguration
$ErrorActionPreference = 'SilentlyContinue'

# If running in a hostprocess container, remove Calico CNI if installed.
# Skip the rest of the logic that applies to manual installations only.
if (($env:CONTAINER_SANDBOX_MOUNT_POINT) -and ($env:CALICO_NETWORKING_BACKEND -NE "none"))
# Skip the rest of the logic that applies to manual installations only,
# unless this is being run by the hostprocess installation itself (which
# will pass the -CleanupForHostProcessInstall param).
if (($env:CONTAINER_SANDBOX_MOUNT_POINT) -and ($env:CALICO_NETWORKING_BACKEND -NE "none") -and (-Not $CleanupForHostProcessInstall))
{
if ($env:CALICO_NETWORKING_BACKEND -NE "none") {
Remove-CNIPlugin
Expand Down
2 changes: 1 addition & 1 deletion node/windows-packaging/host-process-install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ $rootDir = "c:\CalicoWindows"
Write-Host "Uninstalling any existing Calico install before proceeding with installation..."
if ((Get-Service | where Name -Like 'Calico*') -NE $null) {
Write-Host "Calico services running. Executing $rootDir\uninstall-calico.ps1..."
& "$rootDir\uninstall-calico.ps1"
& "$rootDir\uninstall-calico.ps1" -CleanupForHostProcessInstall $true
}
# If this is a hostprocess install, and the root install dir exists, try
# removing any Calico CNI config install
Expand Down

0 comments on commit aadb205

Please sign in to comment.