Skip to content

Commit b233bcd

Browse files
committed
(#732) run.rb: Combine stderr and stdout
By default, `Puppet::Util::Execution.execute` only returns stdout. Puppet writes errors to stderr. When the run task fails, it only shows the successful output: ``` $ bolt task run puppet_agent::run --targets puppet Started on puppet... Finished on puppet: Info: Using environment 'production' Info: Retrieving pluginfacts Info: Retrieving plugin Info: Loading facts Notice: Requesting catalog from puppet.local:8140 (10.0.1.1) Notice: Catalog compiled by puppet.local *long json here* ``` With the patch: ``` $ bolt task run puppet_agent::run --targets puppet Started on puppet... Finished on puppet: Info: Using environment 'production' Info: Retrieving pluginfacts Info: Retrieving plugin Info: Loading facts Notice: Requesting catalog from puppet.local:8140 (10.0.1.1) Notice: Catalog compiled by puppet.spirit-int.betadots.training Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Function Call, Failed to execute '/pdb/query/v4' on at least 1 of the following 'server_urls': https://puppetdb:8081 (file: /opt/puppetlabs/puppet/modules/infrastructure/manifests/puppet/puppetserver.pp, line: 11, column: 14) on node puppet.local Warning: Not using cache on failed catalog Error: Could not retrieve catalog; skipping run *long json here* ``
1 parent 05715a1 commit b233bcd

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tasks/run.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,8 @@ def try_run(last_run_report, params)
155155
options = {
156156
failonfail: false,
157157
custom_environment: get_env_fix_up,
158-
override_locale: false
158+
override_locale: false,
159+
combine: true # combine stdout and stderr
159160
}
160161

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

0 commit comments

Comments
 (0)