summaryrefslogtreecommitdiffstats
path: root/src/lib/Client
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2007-12-28 19:11:57 +0000
committerNarayan Desai <desai@mcs.anl.gov>2007-12-28 19:11:57 +0000
commit7130bc3cca133674f0fc54145755abb040f55ec7 (patch)
tree66b0dd3cd8c25c29813a49345af3b80fe0bac348 /src/lib/Client
parent1b53eefe575e63d8995e7fc9065bec99dbe38927 (diff)
downloadbcfg2-7130bc3cca133674f0fc54145755abb040f55ec7.tar.gz
bcfg2-7130bc3cca133674f0fc54145755abb040f55ec7.tar.bz2
bcfg2-7130bc3cca133674f0fc54145755abb040f55ec7.zip
Add new text pattern to ignore for Chkconfig (Resolves Ticket #505) [bugfix]
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@4120 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib/Client')
-rw-r--r--src/lib/Client/Tools/Chkconfig.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/lib/Client/Tools/Chkconfig.py b/src/lib/Client/Tools/Chkconfig.py
index b068b89af..0f29aca34 100644
--- a/src/lib/Client/Tools/Chkconfig.py
+++ b/src/lib/Client/Tools/Chkconfig.py
@@ -16,17 +16,21 @@ class Chkconfig(Bcfg2.Client.Tools.SvcTool):
def VerifyService(self, entry, _):
'''Verify Service status for entry'''
try:
- srvdata = self.cmd.run('/sbin/chkconfig --list %s | grep -v "unknown service"'
- % entry.attrib['name'])[1][0].split()
+ cmd = "/sbin/chkconfig --list %s " % (entry.get('name'))
+ raw = self.cmd.run(cmd)[1][0]
+ patterns = ["error reading information", "unknown service"]
+ srvdata = [line.split() for line in raw for pattern in patterns \
+ if pattern not in line]
except IndexError:
# Ocurrs when no lines are returned (service not installed)
entry.set('current_status', 'off')
return False
- if entry.attrib['type'] == 'xinetd':
- return entry.attrib['status'] == srvdata[1]
+ if entry.get('type') == 'xinetd':
+ return entry.get('status') == srvdata[1]
try:
- onlevels = [level.split(':')[0] for level in srvdata[1:] if level.split(':')[1] == 'on']
+ onlevels = [level.split(':')[0] for level in srvdata[1:] \
+ if level.split(':')[1] == 'on']
except IndexError:
onlevels = []