|
13 | 13 | Runs without any parameters. Uses all the default values/settings. |
14 | 14 |
|
15 | 15 | .EXAMPLE |
16 | | - ./bootstrap-salt.ps1 -version 2015.4.1-3 |
| 16 | + ./bootstrap-salt.ps1 -version 2017.7.0 |
17 | 17 | Specifies a particular version of the installer. |
18 | 18 |
|
| 19 | +.EXAMPLE |
| 20 | + ./bootstrap-salt.ps1 -pythonVersion 3 |
| 21 | + Specifies the Python version of the installer. Can be "2" or "3". Defaults to "2". |
| 22 | + Python 3 installers are only available for Salt 2017.7.0 and newer. |
| 23 | +
|
19 | 24 | .EXAMPLE |
20 | 25 | ./bootstrap-salt.ps1 -runservice false |
21 | 26 | Specifies the salt-minion service to stop and be set to manual. Useful for |
|
27 | 32 | installer values of host name for the minion id and "salt" for the master. |
28 | 33 |
|
29 | 34 | .EXAMPLE |
30 | | - ./bootstrap-salt.ps1 -minion minion-box -master master-box -version 2015.5.2 -runservice false |
| 35 | + ./bootstrap-salt.ps1 -minion minion-box -master master-box -version 2017.7.0 -runservice false |
31 | 36 | Specifies all the optional parameters in no particular order. |
32 | 37 |
|
33 | 38 | .PARAMETER version |
34 | 39 | Default version defined in this script. |
35 | 40 |
|
| 41 | +.PARAMETER pythonVersion |
| 42 | + The version of Python the installer should use. Specify either "2" or "3". |
| 43 | + Beginning with Salt 2017.7.0, Salt will run on either Python 2 or Python 3. |
| 44 | + The default is Python 2 if not specified. This parameter only works for Salt |
| 45 | + versions >= 2017.7.0. |
| 46 | +
|
36 | 47 | .PARAMETER runservice |
37 | 48 | Boolean flag to start or stop the minion service. True will start the minion |
38 | 49 | service. False will stop the minion service and set it to "manual". The |
@@ -69,6 +80,11 @@ Param( |
69 | 80 | [ValidatePattern('^201\d\.\d{1,2}\.\d{1,2}(\-\d{1})?|(rc\d)$')] |
70 | 81 | [string]$version = '', |
71 | 82 |
|
| 83 | + [Parameter(Mandatory=$false,ValueFromPipeline=$true)] |
| 84 | + # Doesn't support versions prior to "2017.7.0" |
| 85 | + [ValidateSet("2","3")] |
| 86 | + [string]$pythonVersion = "", |
| 87 | + |
72 | 88 | [Parameter(Mandatory=$false,ValueFromPipeline=$true)] |
73 | 89 | [ValidateSet("true","false")] |
74 | 90 | [string]$runservice = "true", |
@@ -113,6 +129,7 @@ If (!(Get-IsAdministrator)) { |
113 | 129 | If($master -ne "not-specified") {$parameters = "$parameters -master $master"} |
114 | 130 | If($runservice -eq $false) {$parameters = "$parameters -runservice false"} |
115 | 131 | If($version -ne '') {$parameters = "$parameters -version $version"} |
| 132 | + If($pythonVersion -ne "") {$parameters = "$parameters -pythonVersion $pythonVersion"} |
116 | 133 | $newProcess.Arguments = $myInvocation.MyCommand.Definition, $parameters |
117 | 134 |
|
118 | 135 | # Specify the current working directory |
@@ -211,13 +228,25 @@ If (!$version) { |
211 | 228 | $returnMatches = $returnMatches | Where {$_ -like "Salt-Minion*AMD64-Setup.exe"} |
212 | 229 | } |
213 | 230 |
|
214 | | - $version = $(($returnMatches | Sort-Object -Descending)[0]).Split(("n-","-A","-x"),([System.StringSplitOptions]::RemoveEmptyEntries))[1] |
| 231 | + $version = $($returnMatches[$returnMatches.Count -1]).Split(("n-","-A","-x","-P"),([System.StringSplitOptions]::RemoveEmptyEntries))[1] |
| 232 | +} |
| 233 | + |
| 234 | +$versionSection = $version |
| 235 | + |
| 236 | +$year = $version.Substring(0, 4) |
| 237 | +If ([int]$year -ge 2017) { |
| 238 | + If ($pythonVersion -eq "3") { |
| 239 | + $versionSection = "$version-Py3" |
| 240 | + } |
| 241 | + Else { |
| 242 | + $versionSection = "$version-Py2" |
| 243 | + } |
215 | 244 | } |
216 | 245 |
|
217 | 246 | #=============================================================================== |
218 | 247 | # Download minion setup file |
219 | 248 | #=============================================================================== |
220 | | -$saltExe = "Salt-Minion-$version-$arch-Setup.exe" |
| 249 | +$saltExe = "Salt-Minion-$versionSection-$arch-Setup.exe" |
221 | 250 | Write-Output "Downloading Salt minion installer $saltExe" |
222 | 251 | $webclient = New-Object System.Net.WebClient |
223 | 252 | $url = "$repourl/$saltExe" |
|
0 commit comments