Simplify puppet cmd generation
We were copy pastaing code in the puppet cmd generation for noop and environment handling. Collapse that to make code easier to read and hopefully avoid future bugs where only one side is edited. Local testing shows that puppet parses commands like: puppet apply test.pp --noop just fine. Change-Id: Ie7665f72b9327b6b834d358699addf2c60a95ec0
This commit is contained in:
parent
b4f591b72d
commit
8cc1cd9126
@ -191,6 +191,11 @@ def main():
|
||||
)
|
||||
if p['puppetmaster']:
|
||||
cmd += " --server %s" % pipes.quote(p['puppetmaster'])
|
||||
else:
|
||||
cmd = "%s apply --detailed-exitcodes " % base_cmd
|
||||
cmd += pipes.quote(p['manifest'])
|
||||
if p['logdest'] != 'stdout':
|
||||
cmd += " --logdest %s" % p['logdest']
|
||||
if p['show_diff']:
|
||||
cmd += " --show_diff"
|
||||
if p['environment']:
|
||||
@ -199,19 +204,6 @@ def main():
|
||||
cmd += " --noop"
|
||||
else:
|
||||
cmd += " --no-noop"
|
||||
else:
|
||||
cmd = "%s apply --detailed-exitcodes " % base_cmd
|
||||
if p['show_diff']:
|
||||
cmd += "--show_diff "
|
||||
if p['logdest'] != 'stdout':
|
||||
cmd += "--logdest %s " % p['logdest']
|
||||
if p['environment']:
|
||||
cmd += "--environment '%s' " % p['environment']
|
||||
if module.check_mode or p['noop']:
|
||||
cmd += "--noop "
|
||||
else:
|
||||
cmd += "--no-noop "
|
||||
cmd += pipes.quote(p['manifest'])
|
||||
rc, stdout, stderr = module.run_command(cmd)
|
||||
|
||||
if rc == 0:
|
||||
|
Loading…
x
Reference in New Issue
Block a user