Merge "Add puppet hook option for --tags"

This commit is contained in:
Jenkins
2015-09-21 20:27:01 +00:00
committed by Gerrit Code Review
3 changed files with 9 additions and 0 deletions

View File

@@ -8,3 +8,5 @@ Hook Options:
use_facter: default True. Set to True to pass puppet inputs via Facter
use_hiera: default False. Set to True to pass puppet inputs via Hiera
modulepath: If set, puppet will use this filesystem path to load modules
tags: If set, puppet will use the specified value(s) to apply only a
subset of the catalog for a given manifest.

View File

@@ -60,6 +60,7 @@ def main(argv=sys.argv):
use_hiera = c['options'].get('enable_hiera', False)
use_facter = c['options'].get('enable_facter', True)
modulepath = c['options'].get('modulepath')
tags = c['options'].get('tags')
facts = {}
hiera = {}
@@ -103,6 +104,9 @@ def main(argv=sys.argv):
if modulepath:
cmd.insert(-1, '--modulepath')
cmd.insert(-1, modulepath)
if tags:
cmd.insert(-1, '--tags')
cmd.insert(-1, tags)
log.debug('Running %s %s' % (env_debug, ' '.join(cmd)))
try:
subproc = subprocess.Popen(cmd, stdout=subprocess.PIPE,

View File

@@ -161,6 +161,7 @@ class HookPuppetTest(common.RunScriptTest):
modulepath = self.working_dir.join()
data = copy.deepcopy(self.data)
data['options']['modulepath'] = modulepath
data['options']['tags'] = 'package,file'
returncode, stdout, stderr = self.run_cmd(
[self.hook_path], self.env, json.dumps(data))
@@ -184,6 +185,8 @@ class HookPuppetTest(common.RunScriptTest):
'--detailed-exitcodes',
'--modulepath',
modulepath,
'--tags',
'package,file',
puppet_script
],
state['args'])