Merge pull request #5892 from PatOShea/master

provisioner/salt: Updated version for windows and added passing in version via vagrantfile
This commit is contained in:
Mitchell Hashimoto 2015-07-06 15:11:08 -06:00
commit cc2d393611
3 changed files with 20 additions and 8 deletions

View File

@ -1,5 +1,11 @@
# Salt version to install
$version = '2014.7.1'
Param(
[string]$version
)
# Salt version to install - default to latest if there is an issue
if ($version -notmatch "201[0-9]\.[0-9]\.[0-9](\-\d{1})?"){
$version = '2015.5.2'
}
# Create C:\tmp\ - if Vagrant doesn't upload keys and/or config it might not exist
New-Item C:\tmp\ -ItemType directory -force | out-null
@ -21,7 +27,7 @@ if ([IntPtr]::Size -eq 4) {
}
# Download minion setup file
Write-Host "Downloading Salt minion installer ($arch)..."
Write-Host "Downloading Salt minion installer $version-$arch..."
$webclient = New-Object System.Net.WebClient
$url = "https://docs.saltstack.com/downloads/Salt-Minion-$version-$arch-Setup.exe"
$file = "C:\tmp\salt.exe"

View File

@ -35,6 +35,7 @@ module VagrantPlugins
attr_accessor :install_syndic
attr_accessor :no_minion
attr_accessor :bootstrap_options
attr_accessor :version
def initialize
@minion_config = UNSET_VALUE
@ -63,6 +64,7 @@ module VagrantPlugins
@config_dir = UNSET_VALUE
@masterless = UNSET_VALUE
@minion_id = UNSET_VALUE
@version = UNSET_VALUE
end
def finalize!
@ -92,6 +94,7 @@ module VagrantPlugins
@config_dir = nil if @config_dir == UNSET_VALUE
@masterless = false if @masterless == UNSET_VALUE
@minion_id = nil if @minion_id == UNSET_VALUE
@version = nil if @version == UNSET_VALUE
end
def pillar(data)

View File

@ -76,7 +76,7 @@ module VagrantPlugins
end
def need_configure
@config.minion_config or @config.minion_key or @config.master_config or @config.master_key or @config.grains_config
@config.minion_config or @config.minion_key or @config.master_config or @config.master_key or @config.grains_config or @config.version
end
def need_install
@ -237,6 +237,9 @@ module VagrantPlugins
bootstrap_path = get_bootstrap
if @machine.config.vm.communicator == :winrm
if @config.version
options = "-version %s" % @config.version
end
bootstrap_destination = File.join(config_dir, "bootstrap_salt.ps1")
else
bootstrap_destination = File.join(config_dir, "bootstrap_salt.sh")
@ -248,7 +251,7 @@ module VagrantPlugins
@machine.communicate.upload(bootstrap_path.to_s, bootstrap_destination)
@machine.communicate.sudo("chmod +x %s" % bootstrap_destination)
if @machine.config.vm.communicator == :winrm
bootstrap = @machine.communicate.sudo("powershell.exe -executionpolicy bypass -file %s" % [bootstrap_destination]) do |type, data|
bootstrap = @machine.communicate.sudo("powershell.exe -executionpolicy bypass -file %s %s" % [bootstrap_destination, options]) do |type, data|
if data[0] == "\n"
# Remove any leading newline but not whitespace. If we wanted to
# remove newlines and whitespace we would have used data.lstrip