class Kontena::Plugin::Vagrant::Master::SshCommand

Public Instance Methods

execute() click to toggle source
# File lib/kontena/plugin/vagrant/master/ssh_command.rb, line 7
def execute
  require 'shellwords'
  require_relative '../../../machine/vagrant'

  vagrant_path = "#{Dir.home}/.krates/vagrant_master"
  abort("Cannot find Vagrant krates-master".colorize(:red)) unless Dir.exist?(vagrant_path)

  cmd = "vagrant ssh"
  if self.commands_list && !self.commands_list.empty?
    cmd << " -c '#{self.commands_list.shelljoin}'"
  end

  Dir.chdir(vagrant_path) do
    system(cmd)
  end
end