diff --git a/lib/vagrant-lxc/action/fetch_ip_with_lxc_info.rb b/lib/vagrant-lxc/action/fetch_ip_with_lxc_info.rb index 38882ac..50d56a3 100644 --- a/lib/vagrant-lxc/action/fetch_ip_with_lxc_info.rb +++ b/lib/vagrant-lxc/action/fetch_ip_with_lxc_info.rb @@ -21,6 +21,7 @@ module Vagrant fetch_ip_tries = config.fetch_ip_tries driver = env[:machine].provider.driver ip = '' + return config.ssh_ip_addr if not config.ssh_ip_addr.nil? retryable(:on => LXC::Errors::ExecuteError, :tries => fetch_ip_tries, :sleep => 3) do unless ip = get_container_ip_from_ip_addr(driver) # retry diff --git a/lib/vagrant-lxc/config.rb b/lib/vagrant-lxc/config.rb index 0a117c3..66f1410 100644 --- a/lib/vagrant-lxc/config.rb +++ b/lib/vagrant-lxc/config.rb @@ -24,6 +24,8 @@ module Vagrant attr_accessor :fetch_ip_tries + attr_accessor :ssh_ip_addr + # Whether the container needs to be privileged. Defaults to true (unprivileged containers # is a very new feature in vagrant-lxc). If false, will try creating an unprivileged # container. If it can't, will revert to the old "sudo wrapper" method to create a privileged @@ -37,6 +39,7 @@ module Vagrant @container_name = UNSET_VALUE @tmpfs_mount_size = UNSET_VALUE @fetch_ip_tries = UNSET_VALUE + @ssh_ip_addr = UNSET_VALUE @privileged = UNSET_VALUE end @@ -66,6 +69,7 @@ module Vagrant @existing_container_name = nil if @existing_container_name == UNSET_VALUE @tmpfs_mount_size = '2G' if @tmpfs_mount_size == UNSET_VALUE @fetch_ip_tries = 10 if @fetch_ip_tries == UNSET_VALUE + @ssh_ip_addr = nil if @ssh_ip_addr == UNSET_VALUE @privileged = true if @privileged == UNSET_VALUE end end