class Chef::Knife::VagrantServerHalt
Public Instance Methods
run()
click to toggle source
# File lib/chef/knife/vagrant_server_halt.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) unless state == 'running' or state == 'saved' ui.error("Instance #{instance} needs to be running or suspended for halt. Current state is #{colored_vagrant_state(state)}") next end vagrant_exec(instance, 'halt') end end