1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

correct handeling of execute option (#23814)

This commit is contained in:
John Bond 2017-08-17 20:50:38 +01:00 committed by ansibot
parent e5ff8e3407
commit 722579356d

View file

@ -213,7 +213,7 @@ def main():
else: else:
base_cmd = PUPPET_CMD base_cmd = PUPPET_CMD
if not p['manifest']: if not p['manifest'] and not p['execute']:
cmd = ("%(base_cmd)s agent --onetime" cmd = ("%(base_cmd)s agent --onetime"
" --ignorecache --no-daemonize --no-usecacheonfailure --no-splay" " --ignorecache --no-daemonize --no-usecacheonfailure --no-splay"
" --detailed-exitcodes --verbose --color 0") % dict( " --detailed-exitcodes --verbose --color 0") % dict(
@ -243,14 +243,15 @@ def main():
cmd += "--environment '%s' " % p['environment'] cmd += "--environment '%s' " % p['environment']
if p['certname']: if p['certname']:
cmd += " --certname='%s'" % p['certname'] cmd += " --certname='%s'" % p['certname']
if p['execute']:
cmd += " --execute '%s'" % p['execute']
if p['tags']: if p['tags']:
cmd += " --tags '%s'" % ','.join(p['tags']) cmd += " --tags '%s'" % ','.join(p['tags'])
if module.check_mode: if module.check_mode:
cmd += "--noop " cmd += "--noop "
else: else:
cmd += "--no-noop " cmd += "--no-noop "
if p['execute']:
cmd += " --execute '%s'" % p['execute']
else:
cmd += pipes.quote(p['manifest']) cmd += pipes.quote(p['manifest'])
rc, stdout, stderr = module.run_command(cmd) rc, stdout, stderr = module.run_command(cmd)