Adding python_version parameter for Windows minions
Ignoring non-Windows Salt parameters Get the correct minion file for ver >= 2017.x.x
This commit is contained in:
parent
010c369e32
commit
384848e92d
|
@ -1,5 +1,6 @@
|
|||
Param(
|
||||
[string]$version,
|
||||
[string]$pythonVersion = "2",
|
||||
[string]$runservice,
|
||||
[string]$minion,
|
||||
[string]$master
|
||||
|
@ -14,6 +15,11 @@ If ($version -notmatch "2\d{3}\.\d{1,2}\.\d+(\-\d{1})?"){
|
|||
$version = '2016.11.3'
|
||||
}
|
||||
|
||||
If ($pythonVersion -notmatch "\d+") {
|
||||
$pythonVersion = "2"
|
||||
Write-Host "Defaulting to minion Python version $pythonVersion"
|
||||
}
|
||||
|
||||
If ($runservice.ToLower() -eq "true"){
|
||||
Write-Host "Service is set to run."
|
||||
[bool]$runservice = $True
|
||||
|
@ -49,11 +55,20 @@ If ([IntPtr]::Size -eq 4) {
|
|||
}
|
||||
|
||||
# Download minion setup file
|
||||
Write-Host "Downloading Salt minion installer Salt-Minion-$version-$arch-Setup.exe"
|
||||
$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/Salt-Minion-$version-$arch-Setup.exe"
|
||||
$url = "https://repo.saltstack.com/windows/$minionFilename"
|
||||
$file = "C:\tmp\salt.exe"
|
||||
$webclient.DownloadFile($url, $file)
|
||||
break
|
||||
}
|
||||
catch {
|
||||
Write-Host "Unable to download $minionFilename"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Install minion silently
|
||||
|
|
|
@ -34,6 +34,7 @@ module VagrantPlugins
|
|||
attr_accessor :no_minion
|
||||
attr_accessor :bootstrap_options
|
||||
attr_accessor :version
|
||||
attr_accessor :python_version
|
||||
attr_accessor :run_service
|
||||
attr_accessor :master_id
|
||||
|
||||
|
@ -64,6 +65,7 @@ module VagrantPlugins
|
|||
@masterless = UNSET_VALUE
|
||||
@minion_id = UNSET_VALUE
|
||||
@version = UNSET_VALUE
|
||||
@python_version = UNSET_VALUE
|
||||
@run_service = UNSET_VALUE
|
||||
@master_id = UNSET_VALUE
|
||||
end
|
||||
|
@ -89,6 +91,7 @@ module VagrantPlugins
|
|||
@masterless = false if @masterless == UNSET_VALUE
|
||||
@minion_id = nil if @minion_id == UNSET_VALUE
|
||||
@version = nil if @version == UNSET_VALUE
|
||||
@python_version = nil if @python_version == UNSET_VALUE
|
||||
@run_service = nil if @run_service == UNSET_VALUE
|
||||
@master_id = nil if @master_id == UNSET_VALUE
|
||||
|
||||
|
|
|
@ -121,7 +121,7 @@ module VagrantPlugins
|
|||
options = "%s -F -c %s" % [options, config_dir]
|
||||
end
|
||||
|
||||
if @config.seed_master && @config.install_master
|
||||
if @config.seed_master && @config.install_master && @machine.config.vm.communicator != :winrm
|
||||
seed_dir = "/tmp/minion-seed-keys"
|
||||
@machine.communicate.sudo("mkdir -p -m777 #{seed_dir}")
|
||||
@config.seed_master.each do |name, keyfile|
|
||||
|
@ -132,27 +132,27 @@ module VagrantPlugins
|
|||
options = "#{options} -k #{seed_dir}"
|
||||
end
|
||||
|
||||
if configure && !install
|
||||
if configure && !install && @machine.config.vm.communicator != :winrm
|
||||
options = "%s -C" % options
|
||||
end
|
||||
|
||||
if @config.install_master
|
||||
if @config.install_master && @machine.config.vm.communicator != :winrm
|
||||
options = "%s -M" % options
|
||||
end
|
||||
|
||||
if @config.install_syndic
|
||||
if @config.install_syndic && @machine.config.vm.communicator != :winrm
|
||||
options = "%s -S" % options
|
||||
end
|
||||
|
||||
if @config.no_minion
|
||||
if @config.no_minion && @machine.config.vm.communicator != :winrm
|
||||
options = "%s -N" % options
|
||||
end
|
||||
|
||||
if @config.install_type
|
||||
if @config.install_type && @machine.config.vm.communicator != :winrm
|
||||
options = "%s %s" % [options, @config.install_type]
|
||||
end
|
||||
|
||||
if @config.install_args
|
||||
if @config.install_args && @machine.config.vm.communicator != :winrm
|
||||
options = "%s %s" % [options, @config.install_args]
|
||||
end
|
||||
|
||||
|
@ -267,6 +267,9 @@ module VagrantPlugins
|
|||
if @config.version
|
||||
options += " -version %s" % @config.version
|
||||
end
|
||||
if @config.python_version
|
||||
options += " -pythonVersion %s" % @config.python_version
|
||||
end
|
||||
if @config.run_service
|
||||
@machine.env.ui.info "Salt minion will be stopped after installing."
|
||||
options += " -runservice %s" % @config.run_service
|
||||
|
|
Loading…
Reference in New Issue