Add minion data to the compound matcher

This commit is contained in:
Thomas Jackson 2013-03-20 12:56:38 -07:00
parent 99fe305127
commit 98a969b45e
2 changed files with 7 additions and 1 deletions

View File

@ -23,6 +23,7 @@ L List of minions ``L@minion1.example.com,minion3.domain.com or bl*.do
I Pillar glob match ``I@pdata:foobar``
S Subnet/IP addr match ``S@192.168.1.0/24`` or ``S@192.168.1.100``
R Range cluster match ``R@%foo.bar``
D Minion Data match ``D@key:value``
====== ==================== ===============================================================
Matchers can be joined using boolean ``and``, ``or``, and ``not`` operators.

View File

@ -1048,6 +1048,10 @@ class Matcher(object):
if fnmatch.fnmatch(str(member).lower(), comps[1].lower()):
return True
return False
if isinstance(val, dict):
if comps[1] in val:
return True
return False
return bool(fnmatch.fnmatch(
val,
comps[1],
@ -1128,7 +1132,8 @@ class Matcher(object):
'I': 'pillar',
'L': 'list',
'S': 'ipcidr',
'E': 'pcre'}
'E': 'pcre',
'D': 'data'}
if HAS_RANGE:
ref['R'] = 'range'
results = []