Merge pull request #8992 from BenjaminSchiborr/fix/master/fix_salt_windows_bootstrap
provisioners/salt: Fixes timeout issue in salt bootstrapping for windows
This commit is contained in:
commit
a724a19a5d
|
@ -65,7 +65,28 @@ Write-Host "Downloading Salt minion installer $minionFilename"
|
||||||
$webclient = New-Object System.Net.WebClient
|
$webclient = New-Object System.Net.WebClient
|
||||||
$url = "https://repo.saltstack.com/windows/$minionFilename"
|
$url = "https://repo.saltstack.com/windows/$minionFilename"
|
||||||
$file = "C:\tmp\salt.exe"
|
$file = "C:\tmp\salt.exe"
|
||||||
$webclient.DownloadFile($url, $file)
|
|
||||||
|
[int]$retries = 0
|
||||||
|
Do {
|
||||||
|
try {
|
||||||
|
$retries++
|
||||||
|
$ErrorActionPreference='Stop'
|
||||||
|
$webclient.DownloadFile($url, $file)
|
||||||
|
break
|
||||||
|
} catch [Exception] {
|
||||||
|
if($retries -eq 5) {
|
||||||
|
$_
|
||||||
|
$_.GetType()
|
||||||
|
$_.Exception
|
||||||
|
$_.Exception.StackTrace
|
||||||
|
Write-Host
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
Write-Warning "Retrying download in 2 seconds. Retry # $retries"
|
||||||
|
Start-Sleep -s 2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Until($retries -eq 5)
|
||||||
|
|
||||||
|
|
||||||
# Install minion silently
|
# Install minion silently
|
||||||
|
|
|
@ -303,7 +303,7 @@ module VagrantPlugins
|
||||||
@machine.communicate.upload(bootstrap_path.to_s, bootstrap_destination)
|
@machine.communicate.upload(bootstrap_path.to_s, bootstrap_destination)
|
||||||
@machine.communicate.sudo("chmod +x %s" % bootstrap_destination)
|
@machine.communicate.sudo("chmod +x %s" % bootstrap_destination)
|
||||||
if @machine.config.vm.communicator == :winrm
|
if @machine.config.vm.communicator == :winrm
|
||||||
bootstrap = @machine.communicate.sudo("powershell.exe -executionpolicy bypass -file %s %s" % [bootstrap_destination, options]) do |type, data|
|
bootstrap = @machine.communicate.sudo("powershell.exe -NonInteractive -NoProfile -executionpolicy bypass -file %s %s" % [bootstrap_destination, options]) do |type, data|
|
||||||
if data[0] == "\n"
|
if data[0] == "\n"
|
||||||
# Remove any leading newline but not whitespace. If we wanted to
|
# Remove any leading newline but not whitespace. If we wanted to
|
||||||
# remove newlines and whitespace we would have used data.lstrip
|
# remove newlines and whitespace we would have used data.lstrip
|
||||||
|
|
Loading…
Reference in New Issue