Class: Linecook::Commands::Stop

Inherits:
VboxCommand show all
Defined in:
lib/linecook/commands/stop.rb

Overview

:startdoc::desc stop a vm

Stops one or more VirtualBox virtual machines using ‘poweroff’. By default all virtual machines configured in config/ssh will be stopped.

Constant Summary

Constants inherited from VboxCommand

VboxCommand::HOST_REGEXP

Constants inherited from Command

Command::REGISTRY

Instance Attribute Summary

Attributes inherited from Command

#quiet

Instance Method Summary collapse

Methods inherited from VboxCommand

#discardstate, #each_host, #each_vm_name, #host_list, #host_map, #load_hosts, #resolve_vm_names, #restore, #running?, #share, #ssh, #ssh!, #ssh_config_file=, #start, #start_ssh_socket, #stop

Methods inherited from Command

#call, inherited, #initialize, #log, registry, #sh, #sh!

Constructor Details

This class inherits a constructor from Linecook::Commands::Command

Instance Method Details

#process(*hosts) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/linecook/commands/stop.rb', line 12

def process(*hosts)
  vm_names = resolve_vm_names(hosts)
  each_vm_name(vm_names) do |vm_name|
    if running?(vm_name)
      stop(vm_name)
    end
  end
end