Check exit codes of puppet provisioners

Previously, failures in applying the puppet manifests would be
ignored, because puppet apply/agent don't have any useful exit codes
by default.  (Errors are printed, but vagrant continues.)

Use the option --detailed-exitcodes of puppet apply/agent to check for
success.
This commit is contained in:
Peter Eisentraut 2012-10-08 15:22:30 -04:00
parent 63a40c598d
commit 901d3ad23b
2 changed files with 2 additions and 2 deletions

View File

@ -153,7 +153,7 @@ module VagrantPlugins
facter = "#{facts.join(" ")} "
end
command = "cd #{manifests_guest_path} && #{facter}puppet apply #{options}"
command = "cd #{manifests_guest_path} && #{facter}puppet apply #{options} --detailed-exitcodes || [ $? -eq 2 ]"
env[:ui].info I18n.t("vagrant.provisioners.puppet.running_puppet",
:manifest => @manifest_file)

View File

@ -67,7 +67,7 @@ module VagrantPlugins
facter = "#{facts.join(" ")} "
end
command = "#{facter}puppet agent #{options} --server #{config.puppet_server}"
command = "#{facter}puppet agent #{options} --server #{config.puppet_server} --detailed-exitcodes || [ $? -eq 2 ]"
env[:ui].info I18n.t("vagrant.provisioners.puppet_server.running_puppetd")
env[:vm].channel.sudo(command) do |type, data|