Various fixes:

* Add missing spaces in help
   * Correct order of arguments to _check_cache_minions() (not part of pillar_pcre)
   * Add platening of pillar_pcre to pillar_exact_minions
   * Add missing match to pillar_pcre
   * Correct unit test
This commit is contained in:
Thayne Harbaugh 2015-04-03 18:32:52 -06:00
parent c91392bc91
commit a7a33b381c
3 changed files with 8 additions and 8 deletions

View file

@ -234,8 +234,8 @@ class CkMinions(object):
Return the minions found by looking via pillar
'''
return self._check_cache_minions(expr,
greedy,
delimiter,
greedy,
'pillar',
exact_match=True)
@ -377,6 +377,7 @@ class CkMinions(object):
'R': self._all_minions}
if pillar_exact:
ref['I'] = self._check_pillar_exact_minions
ref['J'] = self._check_pillar_exact_minions
results = []
unmatched = []
opers = ['and', 'or', 'not', '(', ')']
@ -522,6 +523,7 @@ class CkMinions(object):
if expr_form in ('grain',
'grain_pcre',
'pillar',
'pillar_pcre',
'pillar_exact',
'compound',
'compound_pillar_exact'):

View file

@ -935,7 +935,7 @@ class ExtendedTargetOptionsMixIn(TargetOptionsMixIn):
action='store_true',
help=('Instead of using shell globs to evaluate the target '
'use a pillar value to identify targets, the syntax '
'for the target is the pillar key followed by a glob'
'for the target is the pillar key followed by a glob '
'expression:\n"role:production*"')
)
group.add_option(
@ -944,7 +944,7 @@ class ExtendedTargetOptionsMixIn(TargetOptionsMixIn):
action='store_true',
help=('Instead of using shell globs to evaluate the target '
'use a pillar value to identify targets, the syntax '
'for the target is the pillar key followed by a pcre'
'for the target is the pillar key followed by a pcre '
'regular expression:\n"role:prod.*"')
)
group.add_option(

View file

@ -195,16 +195,14 @@ class MatchTest(integration.ShellCase, integration.ShellCaseCommonTestsMixIn):
'''
test salt pillar PCRE matcher
'''
data = self.run_salt(
'-t 1 --pillar-pcre "monty:^(python|hall)$" test.ping'
)
data = self.run_salt('-J "monty:^(python|hall)$" test.ping')
data = '\n'.join(data)
self.assertIn('minion', data)
self.assertNotIn('sub_minion', data)
self.assertIn('sub_minion', data)
data = self.run_salt('--pillar-pcre "knights:^(Robin|Lancelot)$" test.ping')
data = '\n'.join(data)
self.assertIn('sub_minion', data)
self.assertNotIn('minion', data.replace('sub_minion', 'stub'))
self.assertIn('minion', data.replace('sub_minion', 'stub'))
def test_ipcidr(self):
subnets_data = self.run_salt('--out yaml \'*\' network.subnets')