From 6c5251f499fab506fc530e9387c1e98a84d31b0b Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Tue, 20 May 2014 20:41:48 -0700 Subject: [PATCH] providers/docker: verify host VM SSH is ready [GH-3838] --- CHANGELOG.md | 1 + plugins/providers/docker/action/host_machine.rb | 6 ++++++ plugins/providers/docker/errors.rb | 4 ++++ templates/locales/providers_docker.yml | 11 +++++++++++ 4 files changed, 22 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1587773da..37f8375c6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,7 @@ BUG FIXES: - providers/docker: Don't port map SSH port if container doesn't support SSH. [GH-3857] - providers/docker: Proper SSH info if using native driver. [GH-3799] + - providers/docker: Verify host VM has SSH ready. [GH-3838] - providers/virtualbox: On Windows, check `VBOX_MSI_INSTALL_PATH` for VBoxManage path as well. [GH-3852] - provisioners/puppet: Fix setting facter vars with Windows diff --git a/plugins/providers/docker/action/host_machine.rb b/plugins/providers/docker/action/host_machine.rb index e1210a874..2f38df5b9 100644 --- a/plugins/providers/docker/action/host_machine.rb +++ b/plugins/providers/docker/action/host_machine.rb @@ -54,6 +54,12 @@ module VagrantPlugins host_machine.with_ui(proxy_ui) do host_machine.action(:up) end + + # Verify communication is ready. If not, we have a problem. + if !host_machine.communicate.ready? + raise Errors::HostVMCommunicatorNotReady, + id: host_machine.id + end end end end diff --git a/plugins/providers/docker/errors.rb b/plugins/providers/docker/errors.rb index 9d9504cfb..79e5a9767 100644 --- a/plugins/providers/docker/errors.rb +++ b/plugins/providers/docker/errors.rb @@ -13,6 +13,10 @@ module VagrantPlugins error_key(:execute_error) end + class HostVMCommunicatorNotReady < DockerError + error_key(:host_vm_communicator_not_ready) + end + class ImageNotConfiguredError < DockerError error_key(:docker_provider_image_not_configured) end diff --git a/templates/locales/providers_docker.yml b/templates/locales/providers_docker.yml index 5cf2836d6..ca128a7cc 100644 --- a/templates/locales/providers_docker.yml +++ b/templates/locales/providers_docker.yml @@ -140,6 +140,17 @@ en: Stderr: %{stderr} Stdout: %{stdout} + host_vm_communicator_not_ready: |- + The Docker provider was able to bring up the host VM successfully + but the host VM is still reporting that SSH is unavailable. This + sometimes happens with certain providers due to bugs in the + underlying hypervisor, and can be fixed with a `vagrant reload`. + The ID for the host VM is shown below for convenience. + + If this does not fix it, please verify that the host VM provider + is functional and properly configured. + + Host VM ID: %{id} state_not_running: |- The container never entered the "running" state, or entered it briefly but reverted back to another state. Please verify that