Permalink
Browse files

Handle inaccessible VMs with "vagrant status"

  • Loading branch information...
1 parent ed422e1 commit 2efe1f9135b08548460069647bda94339403de8b @mitchellh mitchellh committed Aug 29, 2011
Showing with 16 additions and 2 deletions.
  1. +11 −2 lib/vagrant/command/status.rb
  2. +5 −0 templates/locales/en.yml
@@ -3,10 +3,19 @@ module Command
class StatusCommand < NamedBase
register "status", "Shows the status of the current Vagrant environment."
- def route
+ def execute
state = nil
results = target_vms.collect do |vm|
- state = vm.created? ? vm.vm.state.to_s : "not_created"
+ if vm.created?
+ if vm.vm.accessible?
+ state = vm.vm.state.to_s
+ else
+ state = "inaccessible"
+ end
+ else
+ state = "not_created"
+ end
+
"#{vm.name.to_s.ljust(25)}#{state.gsub("_", " ")}"
end
View
@@ -191,6 +191,11 @@ en:
stopped without properly closing the session. Run `vagrant up`
to resume this virtual machine. If any problems persist, you may
have to destroy and restart the virtual machine.
+ inaccessible: |-
+ The VM is inaccessible! This is a rare case which means that VirtualBox
+ can't find your VM configuration. This usually happens when upgrading
+ VirtualBox, moving to a new computer, etc. Please consult VirtualBox
+ for how to handle this issue.
output: |-
Current VM states:

0 comments on commit 2efe1f9

Please sign in to comment.