diff options
author | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2012-12-18 11:20:47 -0600 |
---|---|---|
committer | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2012-12-18 11:21:11 -0600 |
commit | 05122a6f04fbbff9838816f6f713e483811c8ed5 (patch) | |
tree | dc367daf0130ddb2ef95faa6ec41f97f09f90f4b /src/lib/Bcfg2/Server/Plugins/Rules.py | |
parent | 1a4148626871df43d2d207db551536813868713e (diff) | |
download | bcfg2-05122a6f04fbbff9838816f6f713e483811c8ed5.tar.gz bcfg2-05122a6f04fbbff9838816f6f713e483811c8ed5.tar.bz2 bcfg2-05122a6f04fbbff9838816f6f713e483811c8ed5.zip |
added unit tests for Rules and Defaults
Diffstat (limited to 'src/lib/Bcfg2/Server/Plugins/Rules.py')
-rw-r--r-- | src/lib/Bcfg2/Server/Plugins/Rules.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/lib/Bcfg2/Server/Plugins/Rules.py b/src/lib/Bcfg2/Server/Plugins/Rules.py index 904876794..21862c5db 100644 --- a/src/lib/Bcfg2/Server/Plugins/Rules.py +++ b/src/lib/Bcfg2/Server/Plugins/Rules.py @@ -6,7 +6,6 @@ import Bcfg2.Server.Plugin class Rules(Bcfg2.Server.Plugin.PrioDir): """This is a generator that handles service assignments.""" - name = 'Rules' __author__ = 'bcfg-dev@mcs.anl.gov' def __init__(self, core, datastore): @@ -19,15 +18,14 @@ class Rules(Bcfg2.Server.Plugin.PrioDir): self.Entries[entry.tag].keys()) return False - def HandleEntry(self, entry, metadata): - return self.BindEntry(entry, metadata) - def BindEntry(self, entry, metadata): attrs = self.get_attrs(entry, metadata) for key, val in list(attrs.items()): if key not in entry.attrib: entry.attrib[key] = val + HandleEntry = BindEntry + def _matches(self, entry, metadata, rules): if Bcfg2.Server.Plugin.PrioDir._matches(self, entry, metadata, rules): return True @@ -48,6 +46,7 @@ class Rules(Bcfg2.Server.Plugin.PrioDir): return True return False + @property def _regex_enabled(self): """ Return True if rules regexes are enabled, False otherwise """ return self.core.setup.cfp.getboolean("rules", "regex", default=False) |