summaryrefslogtreecommitdiffstats
path: root/src/lib/Client/Redhat.py
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2006-06-29 19:15:03 +0000
committerNarayan Desai <desai@mcs.anl.gov>2006-06-29 19:15:03 +0000
commitb0c589fcf1902fbe330f433a1b60833286245fcc (patch)
tree821b5b8149108aa64da617d2c1018b3659cd704d /src/lib/Client/Redhat.py
parent99badcf9823b52c261ebc04e1d85c0c6766f0c31 (diff)
downloadbcfg2-b0c589fcf1902fbe330f433a1b60833286245fcc.tar.gz
bcfg2-b0c589fcf1902fbe330f433a1b60833286245fcc.tar.bz2
bcfg2-b0c589fcf1902fbe330f433a1b60833286245fcc.zip
* Add specific info reporting code for Extra elements
* Add data collection for redhat toolset (rpm/chkconfig) * Add data collection for debian toolset (apt/glob) git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@1904 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib/Client/Redhat.py')
-rw-r--r--src/lib/Client/Redhat.py19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/lib/Client/Redhat.py b/src/lib/Client/Redhat.py
index 93cff62fd..142424e60 100644
--- a/src/lib/Client/Redhat.py
+++ b/src/lib/Client/Redhat.py
@@ -38,9 +38,11 @@ class ToolsetImpl(Toolset):
def VerifyService(self, entry):
'''Verify Service status for entry'''
try:
- srvdata = self.saferun('/sbin/chkconfig --list %s | grep -v "unknown service"'%entry.attrib['name'])[1][0].split()
+ srvdata = self.saferun('/sbin/chkconfig --list %s | grep -v "unknown service"'
+ % entry.attrib['name'])[1][0].split()
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]
@@ -52,10 +54,17 @@ class ToolsetImpl(Toolset):
# chkconfig/init.d service
if entry.get('status') == 'on':
- return len(onlevels) > 0
+ status = len(onlevels) > 0
else:
- return len(onlevels) == 0
-
+ status = len(onlevels) == 0
+
+ if not status:
+ if entry.get('status') == 'on':
+ entry.set('current_status', 'off')
+ else:
+ entry.set('current_status', 'on')
+ return status
+
def InstallService(self, entry):
'''Install Service entry'''
self.saferun("/sbin/chkconfig --add %s"%(entry.attrib['name']))
@@ -91,9 +100,11 @@ class ToolsetImpl(Toolset):
else:
self.logger.debug("Package %s: wrong version installed. want %s have %s" %
(entry.get('name'), entry.get('version'), self.installed[entry.get('name')]))
+ entry.set('current_version', self.installed[entry.get('name')])
return False
else:
self.logger.debug("Package %s: not installed" % (entry.get('name')))
+ entry.set('current_version', 'None')
return False
(vstat, output) = self.saferun("rpm --verify -q %s-%s" % (entry.get('name'), entry.get('version')))