diff options
author | Narayan Desai <desai@mcs.anl.gov> | 2007-01-11 15:37:25 +0000 |
---|---|---|
committer | Narayan Desai <desai@mcs.anl.gov> | 2007-01-11 15:37:25 +0000 |
commit | 4a02429e891163947d8d34934726376fd160440e (patch) | |
tree | 5fe009199e0c458e68e8c6dee49eb2f2dbc3d4ec /src/lib/Server | |
parent | 749eef242b8acf1306912ab8f6c473ca3d221699 (diff) | |
download | bcfg2-4a02429e891163947d8d34934726376fd160440e.tar.gz bcfg2-4a02429e891163947d8d34934726376fd160440e.tar.bz2 bcfg2-4a02429e891163947d8d34934726376fd160440e.zip |
Add negated case for Pkgmgr/Svcmgr/Rules
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@2644 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib/Server')
-rw-r--r-- | src/lib/Server/Plugin.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/lib/Server/Plugin.py b/src/lib/Server/Plugin.py index 2f23f76a5..e5eca8f4e 100644 --- a/src/lib/Server/Plugin.py +++ b/src/lib/Server/Plugin.py @@ -207,6 +207,8 @@ class INode: '''LNodes provide lists of things available at a particular group intersection''' raw = {'Client':"lambda x:'%s' == x.hostname and predicate(x)", 'Group':"lambda x:'%s' in x.groups and predicate(x)"} + nraw = {'Client':"lambda x:'%s' != x.hostname and predicate(x)", + 'Group':"lambda x:'%s' not in x.groups and predicate(x)"} containers = ['Group', 'Client'] ignore = [] @@ -217,8 +219,13 @@ class INode: self.predicate = lambda x:True else: predicate = parent.predicate - if data.tag in self.raw.keys(): - self.predicate = eval(self.raw[data.tag] % (data.get('name')), {'predicate':predicate}) + if data.get('negate', 'false') == 'true': + psrc = raw + else: + psrc = nraw + if data.tag in psrc.keys(): + self.predicate = eval(psrc[data.tag] % (data.get('name')), + {'predicate':predicate}) else: raise Exception mytype = self.__class__ |