Class: Kontena::Plugin::Vagrant::Master::StopCommand

Inherits:
Command
  • Object
show all
Includes:
Cli::Common
Defined in:
lib/kontena/plugin/vagrant/master/stop_command.rb

Instance Method Summary collapse

Instance Method Details

#executeObject



5
6
7
8
9
10
11
12
13
14
# File 'lib/kontena/plugin/vagrant/master/stop_command.rb', line 5

def execute
  require_relative '../../../machine/vagrant'

  vagrant_path = "#{Dir.home}/.krates/vagrant_master"
  abort("Cannot find Vagrant krates-master".colorize(:red)) unless Dir.exist?(vagrant_path)
  Dir.chdir(vagrant_path) do
    spinner "Triggering 'vagrant halt' for krates-master"
    exit $?.exitstatus unless system('vagrant halt')
  end
end