summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2008-01-27 14:49:46 +0000
committerNarayan Desai <desai@mcs.anl.gov>2008-01-27 14:49:46 +0000
commit2e16fc762e014236105d51640f276b89d5d65be9 (patch)
tree4ef18bb36e5fa8164292ecb796c5245285fedd0d
parentf40c9a40effa2706896579a6cc07a2a1448b9335 (diff)
downloadbcfg2-2e16fc762e014236105d51640f276b89d5d65be9.tar.gz
bcfg2-2e16fc762e014236105d51640f276b89d5d65be9.tar.bz2
bcfg2-2e16fc762e014236105d51640f276b89d5d65be9.zip
Sync glob pattern with regex pattern (Resolves Ticket #520)
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@4293 ce84e21b-d406-0410-9b95-82705330c041
-rw-r--r--src/lib/Client/Tools/DebInit.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/lib/Client/Tools/DebInit.py b/src/lib/Client/Tools/DebInit.py
index 9f52861a4..912009280 100644
--- a/src/lib/Client/Tools/DebInit.py
+++ b/src/lib/Client/Tools/DebInit.py
@@ -11,14 +11,20 @@ class DebInit(Bcfg2.Client.Tools.SvcTool):
__handles__ = [('Service', 'deb')]
__req__ = {'Service': ['name', 'status']}
__svcrestart__ = 'restart'
- svcre = re.compile("/etc/.*/[SK]\d\d(?P<name>\S+)")
+ svcre = re.compile("/etc/.*/[SK]\d+(?P<name>\S+)")
# implement entry (Verify|Install) ops
def VerifyService(self, entry, _):
'''Verify Service status for entry'''
- rawfiles = glob.glob("/etc/rc*.d/*%s" % (entry.get('name')))
- files = [filename for filename in rawfiles if \
- self.svcre.match(filename).group('name') == entry.get('name')]
+ rawfiles = glob.glob("/etc/rc*.d/[SK]*%s" % (entry.get('name')))
+ files = []
+ for filename in rawfiles:
+ match = self.svcre.match(filename)
+ if not match:
+ self.logger.error("Failed to match file: %s" % filename)
+ continue
+ if match.group('name') == entry.get('name'):
+ files.append(filename)
if entry.get('status') == 'off':
if files:
entry.set('current_status', 'on')