5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/vagrant-recipe/command.rb', line 5
def execute
cmd, cmd_args = parse_args
cmd && cmd_args or return nil
with_target_vms(nil, single_target: true) do |vm|
vm.config.recipe.finalize!
plain = "sudo chef-solo -c #{vm.config.recipe.chef} -j #{vm.config.recipe.json} --override-runlist \"recipe[#{cmd}]\""
command = ""
command << add_env(vm.config.recipe.env)
command << plain
@logger.info("Executing recipe on remote machine: #{command}")
env = vm.action(:ssh_run, ssh_run_command: command)
status = env[:ssh_run_exit_status] || 0
return status
end
end
|