Class: Linecook::Commands::Start

Inherits:
VirtualBoxCommand show all
Defined in:
lib/linecook/commands/start.rb

Overview

:startdoc::desc start a vm

Starts one or more VirtualBox virtual machines, and resets to a snapshot if provided. By default all virtual machines configured in config/ssh will be reset and started in this way.

Constant Summary

Constants inherited from VirtualBoxCommand

VirtualBoxCommand::HOST_REGEXP

Instance Method Summary collapse

Methods inherited from VirtualBoxCommand

#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 included from Linecook::CommandUtils

#sh, #sh!

Methods inherited from Linecook::Command

#call, help, #initialize, parse, signature

Constructor Details

This class inherits a constructor from Linecook::Command

Instance Method Details

#process(*hosts) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/linecook/commands/start.rb', line 16

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

    unless snapshot.empty?
      restore(vm_name, snapshot)
    end

    start(vm_name, type)
    start_ssh_socket(vm_name) if use_master_socket
  end
end