Class: Chef::Knife::VagrantServerResume
- Inherits:
-
Chef::Knife
- Object
- Chef::Knife
- Chef::Knife::VagrantServerResume
- Includes:
- VagrantBase
- Defined in:
- lib/chef/knife/vagrant_server_resume.rb
Instance Method Summary collapse
Methods included from VagrantBase
#colored_vagrant_state, included, #locate_config_value, #msg_pair, #vagrant_exec, #vagrant_instance_list, #vagrant_instance_state, #write_insecure_key
Instance Method Details
#run ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/chef/knife/vagrant_server_resume.rb', line 11 def run $stdout.sync = true @name_args.each do |instance| unless vagrant_instance_list.detect { |i| i[:name] == instance } ui.error("No instance named #{instance}") next end state, provider = vagrant_instance_state(instance) # saved: VirtualBox # suspended: VMWare Fusion unless state == 'saved' or state == 'suspended' ui.error("Instance #{instance} needs to be suspended for resume. Current state is #{colored_vagrant_state(state)}") next end vagrant_exec(instance, 'resume') end end |