Class: Kontena::Plugin::Vagrant::Master::RestartCommand

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

Instance Method Summary collapse

Instance Method Details

#executeObject



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/kontena/plugin/vagrant/master/restart_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 "Executing 'vagrant reload' for krates-master"
    exit $?.exitstatus unless system('vagrant reload')
    spinner "Vagrant machine restarted"
  end
end