summaryrefslogtreecommitdiff
path: root/vendor/supply_drop/lib
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/supply_drop/lib')
-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