From 8e3831b810a970da79547486b23a57f1b901b32c Mon Sep 17 00:00:00 2001 From: Jonathan LaBroad Date: Tue, 29 Aug 2017 13:13:24 -0400 Subject: [PATCH] Update default minion version to latest (Python 2) Perform check to determine to include python version or not --- plugins/provisioners/salt/bootstrap-salt.ps1 | 26 +++++++++----------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/plugins/provisioners/salt/bootstrap-salt.ps1 b/plugins/provisioners/salt/bootstrap-salt.ps1 index d0655ad42..53bdd18bd 100644 --- a/plugins/provisioners/salt/bootstrap-salt.ps1 +++ b/plugins/provisioners/salt/bootstrap-salt.ps1 @@ -12,7 +12,7 @@ $startupType = "Manual" # Version to install - default to latest if there is an issue If ($version -notmatch "2\d{3}\.\d{1,2}\.\d+(\-\d{1})?"){ - $version = '2016.11.3' + $version = '2017.7.1' } If ($pythonVersion -notmatch "\d+") { @@ -55,21 +55,17 @@ If ([IntPtr]::Size -eq 4) { } # Download minion setup file -$possibleFilenames = @("Salt-Minion-$version-$arch-Setup.exe", "Salt-Minion-$version-Py$pythonVersion-$arch-Setup.exe") -foreach ($minionFilename in $possibleFilenames) { - try { - Write-Host "Downloading Salt minion installer $minionFilename" - $webclient = New-Object System.Net.WebClient - $url = "https://repo.saltstack.com/windows/$minionFilename" - $file = "C:\tmp\salt.exe" - $webclient.DownloadFile($url, $file) - break - } - catch { - Write-Host "Unable to download $minionFilename" - } +$minionFilename = "Salt-Minion-$version-$arch-Setup.exe" +$versionYear = [regex]::Match($version, "\d+").Value +If ([convert]::ToInt32($versionYear) -ge 2017) +{ + $minionFilename = "Salt-Minion-$version-Py$pythonVersion-$arch-Setup.exe" } - +Write-Host "Downloading Salt minion installer $minionFilename" +$webclient = New-Object System.Net.WebClient +$url = "https://repo.saltstack.com/windows/$minionFilename" +$file = "C:\tmp\salt.exe" +$webclient.DownloadFile($url, $file) # Install minion silently Write-Host "Installing Salt minion..."