diff --git a/tasks/run.rb b/tasks/run.rb index 60775b9d..d3037dea 100755 --- a/tasks/run.rb +++ b/tasks/run.rb @@ -99,8 +99,16 @@ def get_result_from_report(last_run_report, run_result, start_time) obj.tag = nil if obj.respond_to?(:tag=) end + ruby_report = report.to_ruby + # check if the run is marked as failed + if ruby_report['status'] == 'failed' + return error_result( + 'puppet_agent/agent-run-error', + "Puppet agent run failed: #{run_result}", + ) + end { - 'report' => report.to_ruby, + 'report' => ruby_report, 'exitcode' => run_result.exitstatus, '_output' => run_result }