aboutsummaryrefslogtreecommitdiff
path: root/vendor
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2013-03-14 02:05:58 -0700
committerelijah <elijah@riseup.net>2013-03-14 02:05:58 -0700
commita76749a837a2552b72be34d91330f8983f740860 (patch)
treeae392ced56be7dc35b22cbe37713b32deabdf169 /vendor
parent2fd87063c0f48b67cb53bba6d52d82a091be6a7b (diff)
downloadleap_cli-a76749a837a2552b72be34d91330f8983f740860.tar.gz
leap_cli-a76749a837a2552b72be34d91330f8983f740860.tar.bz2
added exit codes for puppet apply
Diffstat (limited to 'vendor')
-rw-r--r--vendor/supply_drop/lib/supply_drop/plugin.rb21
1 files changed, 18 insertions, 3 deletions
diff --git a/vendor/supply_drop/lib/supply_drop/plugin.rb b/vendor/supply_drop/lib/supply_drop/plugin.rb
index 9649c5b..48198b4 100644
--- a/vendor/supply_drop/lib/supply_drop/plugin.rb
+++ b/vendor/supply_drop/lib/supply_drop/plugin.rb
@@ -71,15 +71,30 @@ fi
writer = SupplyDrop::Writer::File.new(writer, puppet_write_to_file) unless puppet_write_to_file.nil?
begin
- run "#{puppet_cmd} #{flag}" do |channel, stream, data|
- writer.collect_output(channel[:host], data)
+ exitcode = nil
+ run "#{puppet_cmd} #{flag}; echo exitcode:$?" do |channel, stream, data|
+ if data =~ /exitcode:(\d+)/
+ exitcode = $1
+ writer.collect_output(channel[:host], "Puppet #{command} complete (#{exitcode_description(exitcode)}).\n")
+ else
+ writer.collect_output(channel[:host], data)
+ end
end
- logger.debug "Puppet #{command} complete."
ensure
writer.all_output_collected
end
end
+ def exitcode_description(code)
+ case code
+ when "0" then "no changes"
+ when "2" then "changes made"
+ when "4" then "failed"
+ when "6" then "changes and failures"
+ else code
+ end
+ end
+
def red_text(text)
"\033[0;31m#{text}\033[0m"
end