Merge pull request #426 from fonsecas72/patch-1

Make fetch_ip_tries configurable
This commit is contained in:
Cam Cope 2016-11-11 12:33:18 -05:00 committed by GitHub
commit ae18c05b2b
2 changed files with 7 additions and 1 deletions

View file

@ -19,9 +19,11 @@ module Vagrant
end
def assigned_ip(env)
config = env[:machine].provider_config
fetch_ip_tries = config.fetch_ip_tries
driver = env[:machine].provider.driver
ip = ''
retryable(:on => LXC::Errors::ExecuteError, :tries => 10, :sleep => 3) do
retryable(:on => LXC::Errors::ExecuteError, :tries => fetch_ip_tries, :sleep => 3) do
unless ip = get_container_ip_from_ip_addr(driver)
# retry
raise LXC::Errors::ExecuteError, :command => "lxc-attach"

View file

@ -18,12 +18,15 @@ module Vagrant
# machine name, set this to :machine
attr_accessor :container_name
attr_accessor :fetch_ip_tries
def initialize
@customizations = []
@backingstore = UNSET_VALUE
@backingstore_options = []
@sudo_wrapper = UNSET_VALUE
@container_name = UNSET_VALUE
@fetch_ip_tries = UNSET_VALUE
end
# Customize the container by calling `lxc-start` with the given
@ -51,6 +54,7 @@ module Vagrant
@container_name = nil if @container_name == UNSET_VALUE
@backingstore = "best" if @backingstore == UNSET_VALUE
@existing_container_name = nil if @existing_container_name == UNSET_VALUE
@fetch_ip_tries = 10 if @fetch_ip_tries == UNSET_VALUE
end
end
end