From 722579356d46c09890ef26d32e2b195effaa2ba4 Mon Sep 17 00:00:00 2001 From: John Bond Date: Thu, 17 Aug 2017 20:50:38 +0100 Subject: [PATCH] correct handeling of execute option (#23814) --- lib/ansible/modules/system/puppet.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/ansible/modules/system/puppet.py b/lib/ansible/modules/system/puppet.py index 1f78a7f170f..b00f1ae1007 100644 --- a/lib/ansible/modules/system/puppet.py +++ b/lib/ansible/modules/system/puppet.py @@ -213,7 +213,7 @@ def main(): else: base_cmd = PUPPET_CMD - if not p['manifest']: + if not p['manifest'] and not p['execute']: cmd = ("%(base_cmd)s agent --onetime" " --ignorecache --no-daemonize --no-usecacheonfailure --no-splay" " --detailed-exitcodes --verbose --color 0") % dict( @@ -243,15 +243,16 @@ def main(): cmd += "--environment '%s' " % p['environment'] if p['certname']: cmd += " --certname='%s'" % p['certname'] - if p['execute']: - cmd += " --execute '%s'" % p['execute'] if p['tags']: cmd += " --tags '%s'" % ','.join(p['tags']) if module.check_mode: cmd += "--noop " else: cmd += "--no-noop " - cmd += pipes.quote(p['manifest']) + if p['execute']: + cmd += " --execute '%s'" % p['execute'] + else: + cmd += pipes.quote(p['manifest']) rc, stdout, stderr = module.run_command(cmd) if rc == 0: