provisioners/shell: retry getting SSH info a few times [GH-3924]
This commit is contained in:
parent
7d6f9a60b2
commit
a7d3458abc
|
@ -76,6 +76,7 @@ BUG FIXES:
|
||||||
- provisioners/docker: Get GPG key over SSL. [GH-4597]
|
- provisioners/docker: Get GPG key over SSL. [GH-4597]
|
||||||
- provisioners/docker: Search for docker binary in multiple places. [GH-4580]
|
- provisioners/docker: Search for docker binary in multiple places. [GH-4580]
|
||||||
- provisioners/salt: Highstate works properly with a master. [GH-4471]
|
- provisioners/salt: Highstate works properly with a master. [GH-4471]
|
||||||
|
- provisioners/shell: Retry getting SSH info a few times. [GH-3924]
|
||||||
- provisioners/shell: PowerShell scripts can have args. [GH-4548]
|
- provisioners/shell: PowerShell scripts can have args. [GH-4548]
|
||||||
- synced\_folders/nfs: Don't modify NFS exports file if no exports. [GH-4619]
|
- synced\_folders/nfs: Don't modify NFS exports file if no exports. [GH-4619]
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,13 @@ require "pathname"
|
||||||
require "tempfile"
|
require "tempfile"
|
||||||
|
|
||||||
require "vagrant/util/downloader"
|
require "vagrant/util/downloader"
|
||||||
|
require "vagrant/util/retryable"
|
||||||
|
|
||||||
module VagrantPlugins
|
module VagrantPlugins
|
||||||
module Shell
|
module Shell
|
||||||
class Provisioner < Vagrant.plugin("2", :provisioner)
|
class Provisioner < Vagrant.plugin("2", :provisioner)
|
||||||
|
extend Vagrant::Util::Retryable
|
||||||
|
|
||||||
def provision
|
def provision
|
||||||
args = ""
|
args = ""
|
||||||
if config.args.is_a?(String)
|
if config.args.is_a?(String)
|
||||||
|
@ -50,7 +53,13 @@ module VagrantPlugins
|
||||||
# Upload the script to the machine
|
# Upload the script to the machine
|
||||||
@machine.communicate.tap do |comm|
|
@machine.communicate.tap do |comm|
|
||||||
# Reset upload path permissions for the current ssh user
|
# Reset upload path permissions for the current ssh user
|
||||||
user = @machine.ssh_info[:username]
|
info = nil
|
||||||
|
retryable(on: Vagrant::Errors::SSHNotReady, tries: 3, sleep: 2) do
|
||||||
|
info = @machine.ssh_info
|
||||||
|
raise Vagrant::Errors::SSHNotReady if info.nil?
|
||||||
|
end
|
||||||
|
|
||||||
|
user = info[:username]
|
||||||
comm.sudo("chown -R #{user} #{config.upload_path}",
|
comm.sudo("chown -R #{user} #{config.upload_path}",
|
||||||
error_check: false)
|
error_check: false)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue