summaryrefslogtreecommitdiffstats
path: root/src
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
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')
-rw-r--r--src/lib/Client/Debian.py6
-rw-r--r--src/lib/Client/Redhat.py19
-rw-r--r--src/lib/Client/Toolset.py6
3 files changed, 25 insertions, 6 deletions
diff --git a/src/lib/Client/Debian.py b/src/lib/Client/Debian.py
index 113d304a6..9632bd08c 100644
--- a/src/lib/Client/Debian.py
+++ b/src/lib/Client/Debian.py
@@ -50,6 +50,7 @@ class ToolsetImpl(Bcfg2.Client.Toolset.Toolset):
files = [filename for filename in rawfiles if self.svcre.match(filename).group('name') == entry.get('name')]
if entry.get('status') == 'off':
if files:
+ entry.set('current_status', 'on')
return False
else:
return True
@@ -57,6 +58,7 @@ class ToolsetImpl(Bcfg2.Client.Toolset.Toolset):
if files:
return True
else:
+ entry.set('current_status', 'off')
return False
def InstallService(self, entry):
@@ -97,6 +99,10 @@ class ToolsetImpl(Bcfg2.Client.Toolset.Toolset):
if [filename for filename in output if filename not in modlist]:
return False
return True
+ else:
+ entry.set('current_version', self.installed[entry.get('name')])
+ return False
+ entry.set('current_version', 'None')
return False
def Inventory(self):
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')))
diff --git a/src/lib/Client/Toolset.py b/src/lib/Client/Toolset.py
index 5ca0450cd..46bd117a9 100644
--- a/src/lib/Client/Toolset.py
+++ b/src/lib/Client/Toolset.py
@@ -208,8 +208,10 @@ class Toolset(object):
newent.set(field, ent.get(field))
if self.extra_services + self.pkgwork['remove']:
extra = lxml.etree.SubElement(stats, "Extra")
- [lxml.etree.SubElement(extra, "Service", name=svc) for svc in self.extra_services]
- [lxml.etree.SubElement(extra, "Package", name=pkg) for pkg in self.pkgwork['remove']]
+ [lxml.etree.SubElement(extra, "Service", name=svc, current_status='on')
+ for svc in self.extra_services]
+ [lxml.etree.SubElement(extra, "Package", name=pkg,
+ current_version=self.installed[pkg]) for pkg in self.pkgwork['remove']]
return stats
# the next two are dispatch functions