From ccdc89d516e5edcdefeafcf74af681d2d757feff Mon Sep 17 00:00:00 2001 From: Brian Pellin Date: Thu, 6 Jan 2005 22:50:49 +0000 Subject: Fixed service verification for services that are not installed. Added check for invalid service verification. (Logical change 1.175) git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@762 ce84e21b-d406-0410-9b95-82705330c041 --- src/lib/Client/Redhat.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/lib/Client/Redhat.py') diff --git a/src/lib/Client/Redhat.py b/src/lib/Client/Redhat.py index d5e9f6424..f35fc5883 100644 --- a/src/lib/Client/Redhat.py +++ b/src/lib/Client/Redhat.py @@ -35,7 +35,11 @@ class Redhat(Toolset): def VerifyService(self, entry): '''Verify Service status for entry''' - srvdata = popen("/sbin/chkconfig --list %s"%entry.attrib['name']).readlines()[0].split() + try: + srvdata = popen("/sbin/chkconfig --list %s"%entry.attrib['name']).readlines()[0].split() + except IndexError: + # Ocurrs when no lines are returned (service not installed) + return False if entry.attrib['type'] == 'xinetd': if entry.attrib['status'] == srvdata[1]: return True @@ -82,6 +86,9 @@ class Redhat(Toolset): def VerifyPackage(self, entry, modlist = []): '''Verify Package status for entry''' + if ! (entry.get('name') and entry.get('version')): + print "Can't install package, not enough data." + return False instp = Popen4("rpm -qi %s-%s" % (entry.attrib['name'], entry.attrib['version'])) istat = instp.wait()/256 if istat == 0: -- cgit v1.2.3-1-g7c22