diff options
author | Narayan Desai <desai@mcs.anl.gov> | 2007-01-10 22:40:15 +0000 |
---|---|---|
committer | Narayan Desai <desai@mcs.anl.gov> | 2007-01-10 22:40:15 +0000 |
commit | 749eef242b8acf1306912ab8f6c473ca3d221699 (patch) | |
tree | f9b51661f8ad42ba8a5f5ca00ea2e69701e5cf66 /src/lib | |
parent | 95b3c04e41a6f0e7497d2f87152c66a45d71604e (diff) | |
download | bcfg2-749eef242b8acf1306912ab8f6c473ca3d221699.tar.gz bcfg2-749eef242b8acf1306912ab8f6c473ca3d221699.tar.bz2 bcfg2-749eef242b8acf1306912ab8f6c473ca3d221699.zip |
Implement negation for bundles, base, pkgmgr, svcmgr, and rules
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@2643 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/Server/Plugin.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/lib/Server/Plugin.py b/src/lib/Server/Plugin.py index 8d944e7f8..2f23f76a5 100644 --- a/src/lib/Server/Plugin.py +++ b/src/lib/Server/Plugin.py @@ -187,8 +187,12 @@ class StructFile(XMLFileBacked): and not isinstance(item, lxml.etree._Comment)] for group in [item for item in worklist if item.tag == 'Group']: # if only python had forceable early-binding - newpred = eval("lambda x:'%s' in x.groups and predicate(x)" % (group.get('name')), - {'predicate':predicate}) + if group.get('negate', 'false') == 'true': + cmd = "lambda x:'%s' not in x.groups and predicate(x)" + else: + cmd = "lambda x:'%s' in x.groups and predicate(x)" + + newpred = eval(cmd % (group.get('name')), {'predicate':predicate}) work[newpred] = group.getchildren() def Match(self, metadata): |