Run puppet in shell and combine stderr/stdout

We can't sanely do this in the python layer, so turn python into
a command generator.

Change-Id: Ifd2e3c4807a1364d7af5a2bb9c1b4ea9a77833bf
This commit is contained in:
Monty Taylor 2020-04-30 13:10:56 -05:00
parent eafdbf9593
commit f9d35d6800
2 changed files with 9 additions and 1 deletions

View File

@ -266,6 +266,8 @@ def main():
cmd += " --no-noop --detailed-exitcodes"
if p['debug']:
cmd += " --debug"
module.exit_json(changed=True, cmd=cmd)
rc, stdout, stderr = module.run_command(cmd)
if rc == 0:

View File

@ -129,7 +129,7 @@
- block:
- name: run puppet
- name: Get run puppet command
puppet:
puppetmaster: "{{ puppetmaster|default(omit) }}"
manifest: "{{ manifest|default(omit) }}"
@ -142,6 +142,12 @@
noop: "{{ puppet_noop|default(omit) }}"
debug: "{{ puppet_debug|default(omit) }}"
timeout: "{{ puppet_timeout|default(omit) }}"
register: puppet_cmd
- name: Run puppet
shell: "{{ puppet_cmd.cmd }} 2>&1"
register: puppet_cmd_results
failed_when: puppet_cmd_results != 0 and puppet_cmd_results != 2
always:
- block: