diff options
Diffstat (limited to 'src/lib/Client')
-rw-r--r-- | src/lib/Client/Debian.py | 6 | ||||
-rw-r--r-- | src/lib/Client/Redhat.py | 19 | ||||
-rw-r--r-- | src/lib/Client/Toolset.py | 6 |
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 |