diff --git a/plugins/provisioners/salt/bootstrap-salt.ps1 b/plugins/provisioners/salt/bootstrap-salt.ps1 index 0b8355860..85ad32cc2 100644 --- a/plugins/provisioners/salt/bootstrap-salt.ps1 +++ b/plugins/provisioners/salt/bootstrap-salt.ps1 @@ -65,7 +65,28 @@ 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) + +[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 diff --git a/plugins/provisioners/salt/provisioner.rb b/plugins/provisioners/salt/provisioner.rb index c703c4cc1..d5aade262 100644 --- a/plugins/provisioners/salt/provisioner.rb +++ b/plugins/provisioners/salt/provisioner.rb @@ -303,7 +303,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 %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" # Remove any leading newline but not whitespace. If we wanted to # remove newlines and whitespace we would have used data.lstrip