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
|
# File 'lib/vagrant-chef-apply/provisioner.rb', line 7
def provision
command = "chmod +x #{config.upload_path} && chef-apply #{config.upload_path}"
@machine.communicate.tap do |comm|
user = @machine.ssh_info[:username]
comm.sudo("chown -R #{user} #{config.upload_path}",
:error_check => false)
comm.upload(config.path, config.upload_path)
@machine.ui.info(I18n.t("vagrant.provisioners.chef_apply.running",
script: config.path))
comm.sudo(command) do |type, data|
if [:stderr, :stdout].include?(type)
color = type == :stdout ? :green : :red
@machine.env.ui.info(data.chomp, :color => color, :prefix => false)
end
end
end
end
|