9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/kontena/plugin/vagrant/nodes/ssh_command.rb', line 9
def execute
require_api_url
require_current_grid
require 'shellwords'
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)
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
|