6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/vagrant-kick.rb', line 6
def execute
target_vms.each do |vm|
if vm.created?
if !vm.vm.accessible?
raise Errors::VMInaccessible
elsif vm.vm.running?
puts
puts "[#{vm.name}] REMOTE"
File.open("tests/#{vm.name}.ssh", "r").each do |infile|
commands = infile
vm.ssh.execute do |ssh|
ssh.sudo!(commands) do |channel, type, data|
puts
ssh.check_exit_status(data, commands) if type == :exit_status
vm.env.ui.info(infile) if type != :exit_status
vm.env.ui.info(data) if type != :exit_status
end
end
end
puts
system "./tests/#{vm.name}.local"
puts "[#{vm.name}] LOCAL"
File.open("tests/#{vm.name}.local", "r").each do |infile|
puts "[#{vm.name}] #{infile}"
system "#{infile}"
end
else
vm.env.ui.info I18n.t("vagrant.commands.common.vm_not_running")
end
else
vm.env.ui.info I18n.t("vagrant.commands.common.vm_not_created")
end
end
end
|