New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Machines fail to come back up cleanly with hostmanager installed #121
Comments
I believe I have found the root cause here, which is the usage of From the Vagrant docs,
So this will return the set of machines that have been created, but will also include those in the |
Same problem here. |
Same here |
I believe the problem shows up if you have a custom ip_resolver which most people would since the normal ip_resolver just looks at the ssh_config. With a custom ip_resolver, you just have to catch the exception when trying to ssh into the machine that is down. Here is my ip_resolver for reference: $logger = Log4r::Logger.new('vagrantfile')
def read_ip_address(machine)
command = "LANG=en ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1 }'"
result = ""
$logger.info "Processing #{ machine.name } ... "
begin
# sudo is needed for ifconfig
machine.communicate.sudo(command) do |type, data|
result << data if type == :stdout
end
$logger.info "Processing #{ machine.name } ... success"
rescue
result = "# NOT-UP"
$logger.info "Processing #{ machine.name } ... not running"
end
# the second inet is more accurate
result.chomp.split("\n").last
end
Vagrant.configure("2") do |config|
# ...
if Vagrant.has_plugin?("HostManager")
# ...
config.hostmanager.ip_resolver = proc do |vm, resolving_vm|
read_ip_address(vm)
end |
Thanks @pykler that worked for me. |
yeah wrap in begin/rescue works for me too. thanks @pykler |
The bug is discussed here: devopsgroup-io/vagrant-hostmanager#121 so use the suggested workaround in ip resolver to catch the error. Change-Id: Ibac510ca9aef57b508036266987b136d95771074
Project: openstack-dev/devstack-vagrant f748559f8f554b8f80c9f74486bc8a2008e5411b Fix hostmanger ip resolver exception when guest is not really up The bug is discussed here: devopsgroup-io/vagrant-hostmanager#121 so use the suggested workaround in ip resolver to catch the error. Change-Id: Ibac510ca9aef57b508036266987b136d95771074
I have the following block in my
Vagrantfile
to only run hostmanager if it is installed:When it is installed, provisioning my boxes works fine, however if I halt them, and then do a
vagrant up
each box fails with the message below - removing hostmanager allows them to start up cleanly.I have 5 boxes in this config and each one fails at the hostmanager stage.
The box is left in an up and running state, it is just annoying to run
vagrant up
five times in order to bring up all of my boxes after a halt.The text was updated successfully, but these errors were encountered: