diff options
author | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2012-07-24 15:14:51 -0400 |
---|---|---|
committer | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2012-07-24 15:14:51 -0400 |
commit | 1109474bfc7e1fbbd0ba298ef9d44810bb3aea7d (patch) | |
tree | 15c891859df5befa2deae9f3573cb913f532d1cb /src/lib | |
parent | dcf8fddddfa98f39549b57c89c5f79275b0c6b1c (diff) | |
download | bcfg2-1109474bfc7e1fbbd0ba298ef9d44810bb3aea7d.tar.gz bcfg2-1109474bfc7e1fbbd0ba298ef9d44810bb3aea7d.tar.bz2 bcfg2-1109474bfc7e1fbbd0ba298ef9d44810bb3aea7d.zip |
GroupPatterns improvements
Use re.search() instead of re.match() for more flexible regex
Better stringification of pattern objects
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/Bcfg2/Server/Plugins/GroupPatterns.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/lib/Bcfg2/Server/Plugins/GroupPatterns.py b/src/lib/Bcfg2/Server/Plugins/GroupPatterns.py index 1ee312de8..837f47279 100644 --- a/src/lib/Bcfg2/Server/Plugins/GroupPatterns.py +++ b/src/lib/Bcfg2/Server/Plugins/GroupPatterns.py @@ -61,7 +61,7 @@ class PatternMap(object): return self.groups def process_re(self, name): - match = self.re.match(name) + match = self.re.search(name) if not match: return None ret = list() @@ -73,6 +73,10 @@ class PatternMap(object): ret.append(newg) return ret + def __str__(self): + return "%s: %s %s" % (self.__class__.__name__, self.pattern, + self.groups) + class PatternFile(Bcfg2.Server.Plugin.XMLFileBacked): __identifier__ = None @@ -116,7 +120,6 @@ class PatternFile(Bcfg2.Server.Plugin.XMLFileBacked): class GroupPatterns(Bcfg2.Server.Plugin.Plugin, Bcfg2.Server.Plugin.Connector): name = "GroupPatterns" - experimental = True def __init__(self, core, datastore): Bcfg2.Server.Plugin.Plugin.__init__(self, core, datastore) |