summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClark Boylan <clark.boylan@gmail.com>2016-09-16 12:35:25 -0700
committerMonty Taylor <mordred@inaugust.com>2016-10-01 08:11:12 -0700
commit8cc1cd9126b2edb360dd0b3182dd9c283aabc0a3 (patch)
tree815e632c5c314fd47b21ed20fe3ef238aebef6b1
parentb4f591b72d2066be38ec6981420634d437b87a37 (diff)
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
Notes
Notes (review): Code-Review+2: Paul Belanger <pabelanger@redhat.com> Code-Review+2: Spencer Krum <nibz@spencerkrum.com> Workflow+1: James E. Blair <corvus@inaugust.com> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Tue, 04 Oct 2016 21:18:16 +0000 Reviewed-on: https://review.openstack.org/371778 Project: openstack-infra/ansible-role-puppet Branch: refs/heads/master
-rw-r--r--library/puppet28
1 files changed, 10 insertions, 18 deletions
diff --git a/library/puppet b/library/puppet
index 3b23610..3130686 100644
--- a/library/puppet
+++ b/library/puppet
@@ -191,27 +191,19 @@ def main():
191 ) 191 )
192 if p['puppetmaster']: 192 if p['puppetmaster']:
193 cmd += " --server %s" % pipes.quote(p['puppetmaster']) 193 cmd += " --server %s" % pipes.quote(p['puppetmaster'])
194 if p['show_diff']:
195 cmd += " --show_diff"
196 if p['environment']:
197 cmd += " --environment '%s'" % p['environment']
198 if module.check_mode or p['noop']:
199 cmd += " --noop"
200 else:
201 cmd += " --no-noop"
202 else: 194 else:
203 cmd = "%s apply --detailed-exitcodes " % base_cmd 195 cmd = "%s apply --detailed-exitcodes " % base_cmd
204 if p['show_diff']:
205 cmd += "--show_diff "
206 if p['logdest'] != 'stdout':
207 cmd += "--logdest %s " % p['logdest']
208 if p['environment']:
209 cmd += "--environment '%s' " % p['environment']
210 if module.check_mode or p['noop']:
211 cmd += "--noop "
212 else:
213 cmd += "--no-noop "
214 cmd += pipes.quote(p['manifest']) 196 cmd += pipes.quote(p['manifest'])
197 if p['logdest'] != 'stdout':
198 cmd += " --logdest %s" % p['logdest']
199 if p['show_diff']:
200 cmd += " --show_diff"
201 if p['environment']:
202 cmd += " --environment '%s'" % p['environment']
203 if module.check_mode or p['noop']:
204 cmd += " --noop"
205 else:
206 cmd += " --no-noop"
215 rc, stdout, stderr = module.run_command(cmd) 207 rc, stdout, stderr = module.run_command(cmd)
216 208
217 if rc == 0: 209 if rc == 0: