From 20aa1ef55ef67951a2ab6fdf97524e93602a4a38 Mon Sep 17 00:00:00 2001 From: Esa Varemo Date: Fri, 10 Apr 2020 21:21:07 +0300 Subject: [PATCH] Fix command line construction in the puppet module (#114) * puppet: fix check-mode Commit 69ead0ba7864b1e7367eb9755b51d30ecc0da0d2 in the ansible/ansible repository introduced another if-statement in the middle of a if/elif pair, which causes the elif to execute together with the original if which created '--noop --no-noop' commands * puppet: fix manifest whitespace There was a space missing before the manifest path causing issues like: "invalid option: --noop/test.pp" * puppet: Add a changelog entry for 8d7c830 and 6ed7f06 --- .../114-puppet-commandline-construction.yml | 2 ++ plugins/modules/system/puppet.py | 12 ++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) create mode 100644 changelogs/fragments/114-puppet-commandline-construction.yml diff --git a/changelogs/fragments/114-puppet-commandline-construction.yml b/changelogs/fragments/114-puppet-commandline-construction.yml new file mode 100644 index 0000000000..2c48170a59 --- /dev/null +++ b/changelogs/fragments/114-puppet-commandline-construction.yml @@ -0,0 +1,2 @@ +bugfixes: +- "puppet - fix command line construction for check mode and ``manifest:``" diff --git a/plugins/modules/system/puppet.py b/plugins/modules/system/puppet.py index 8efe2c85d7..c73a21a9fa 100644 --- a/plugins/modules/system/puppet.py +++ b/plugins/modules/system/puppet.py @@ -255,16 +255,16 @@ def main(): cmd += " --certname='%s'" % p['certname'] if module.check_mode: cmd += " --noop" - if p['use_srv_records'] is not None: - if not p['use_srv_records']: - cmd += " --no-use_srv_records" - else: - cmd += " --use_srv_records" elif 'noop' in p: if p['noop']: cmd += " --noop" else: cmd += " --no-noop" + if p['use_srv_records'] is not None: + if not p['use_srv_records']: + cmd += " --no-use_srv_records" + else: + cmd += " --use_srv_records" else: cmd = "%s apply --detailed-exitcodes " % base_cmd if p['logdest'] == 'syslog': @@ -289,7 +289,7 @@ def main(): if p['execute']: cmd += " --execute '%s'" % p['execute'] else: - cmd += shlex_quote(p['manifest']) + cmd += " %s" % shlex_quote(p['manifest']) if p['summarize']: cmd += " --summarize" if p['debug']: