Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(#732) puppet_agent::run: mark failed puppet runs as failed task #742

Merged
merged 2 commits into from
Dec 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions tasks/run.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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',
joshcooper marked this conversation as resolved.
Show resolved Hide resolved
"Puppet agent run failed: #{run_result}",
)
end
{
'report' => report.to_ruby,
'report' => ruby_report,
'exitcode' => run_result.exitstatus,
'_output' => run_result
}
Expand Down Expand Up @@ -155,7 +163,8 @@ def try_run(last_run_report, params)
options = {
failonfail: false,
custom_environment: get_env_fix_up,
override_locale: false
override_locale: false,
combine: true # combine stdout and stderr
}

run_result = Puppet::Util::Execution.execute(command.reject(&:empty?), options)
Expand Down
Loading