Class: Kontena::Plugin::Vagrant::Nodes::StartCommand

Inherits:
Command
  • Object
show all
Includes:
Cli::Common, Cli::GridOptions
Defined in:
lib/kontena/plugin/vagrant/nodes/start_command.rb

Instance Method Summary collapse

Instance Method Details

#executeObject



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/kontena/plugin/vagrant/nodes/start_command.rb', line 8

def execute
  require_api_url
  require_current_grid

  require_relative '../../../machine/vagrant'

  vagrant_path = "#{Dir.home}/.kontena/#{current_grid}/#{name}"
  abort("Cannot find Vagrant node #{name}".colorize(:red)) unless Dir.exist?(vagrant_path)
  Dir.chdir(vagrant_path) do
    spinner "Triggering 'vagrant up' for #{name.colorize(:cyan)}"
    exit $?.exitstatus unless system('vagrant up')
  end
end