From 901d3ad23b0d29bdaa6d88cef09fed5bc5891f7c Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Mon, 8 Oct 2012 15:22:30 -0400 Subject: [PATCH] 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. --- plugins/provisioners/puppet/provisioner/puppet.rb | 2 +- plugins/provisioners/puppet/provisioner/puppet_server.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/provisioners/puppet/provisioner/puppet.rb b/plugins/provisioners/puppet/provisioner/puppet.rb index c0693257f..c06ea9be9 100644 --- a/plugins/provisioners/puppet/provisioner/puppet.rb +++ b/plugins/provisioners/puppet/provisioner/puppet.rb @@ -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) diff --git a/plugins/provisioners/puppet/provisioner/puppet_server.rb b/plugins/provisioners/puppet/provisioner/puppet_server.rb index 2198c68f0..e88668a6c 100644 --- a/plugins/provisioners/puppet/provisioner/puppet_server.rb +++ b/plugins/provisioners/puppet/provisioner/puppet_server.rb @@ -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|