summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBrian Pellin <bpellin@mcs.anl.gov>2005-01-06 22:50:49 +0000
committerBrian Pellin <bpellin@mcs.anl.gov>2005-01-06 22:50:49 +0000
commitccdc89d516e5edcdefeafcf74af681d2d757feff (patch)
treeab510b107eab3380ddc3a501f122330fb8cb066e /src
parentda4f6ae07d1b79c12c7622bb1c20f54558d4ced6 (diff)
downloadbcfg2-ccdc89d516e5edcdefeafcf74af681d2d757feff.tar.gz
bcfg2-ccdc89d516e5edcdefeafcf74af681d2d757feff.tar.bz2
bcfg2-ccdc89d516e5edcdefeafcf74af681d2d757feff.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/lib/Client/Redhat.py9
1 files changed, 8 insertions, 1 deletions
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: