summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2005-10-24 21:22:15 +0000
committerNarayan Desai <desai@mcs.anl.gov>2005-10-24 21:22:15 +0000
commit72f3414dca7166181058f6dea86ee3c2e6010b64 (patch)
treecc7c58ecc27486dbd7e96384676f3a9dad2ffae0 /src
parent73898c3d20de00f39d5144b55318bc7ded89de23 (diff)
downloadbcfg2-72f3414dca7166181058f6dea86ee3c2e6010b64.tar.gz
bcfg2-72f3414dca7166181058f6dea86ee3c2e6010b64.tar.bz2
bcfg2-72f3414dca7166181058f6dea86ee3c2e6010b64.zip
typo
2005/10/24 05:05:47-05:00 anl.gov!desai simplify 2005/10/24 04:53:17-05:00 anl.gov!desai simplify pkg verification logic (Logical change 1.343) git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@1417 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src')
-rw-r--r--src/lib/Client/Redhat.py28
1 files changed, 7 insertions, 21 deletions
diff --git a/src/lib/Client/Redhat.py b/src/lib/Client/Redhat.py
index afd7894de..87d8d2b07 100644
--- a/src/lib/Client/Redhat.py
+++ b/src/lib/Client/Redhat.py
@@ -5,9 +5,8 @@
__revision__ = '$Revision$'
from os import popen, system
-from popen2 import Popen4
-from Bcfg2.Client.Toolset import Toolset
+from Bcfg2.Client.Toolset import Toolset, saferun
class Redhat(Toolset):
'''This class implelements support for rpm packages and standard chkconfig services'''
@@ -73,10 +72,7 @@ class Redhat(Toolset):
else:
cmdrc = system("/sbin/chkconfig %s %s" %
(entry.attrib['name'], entry.attrib['status']))
- if cmdrc == 0:
- return True
- else:
- return False
+ return cmdrc == 0
def VerifyPackage(self, entry, modlist):
'''Verify Package status for entry'''
@@ -95,23 +91,13 @@ class Redhat(Toolset):
self.CondPrint('debug', "Package %s: not installed" % (entry.get('name')))
return False
- verp = Popen4("rpm --verify -q %s-%s" %
- (entry.get('name'),entry.get('version')), bufsize=16384)
- odata = verp.fromchild.read()
- vstat = verp.poll()
- while vstat == -1:
- odata += verp.fromchild.read()
- vstat = verp.poll()
- output = [line for line in odata.split("\n") if line]
- if vstat == 0:
- return True
- else:
- if len([name for name in output if name.split()[-1] not in modlist]):
- return True
- else:
+ (vstat, output) = saferun("rpm --verify -q %s-%s" % (entry.get('name'), entry.get('version')))
+ if vstat != 0:
+ if [name for name in output if name.split()[-1] not in modlist]:
self.CondPrint('debug',
"Package %s content verification failed" % entry.get('name'))
- return False
+ return False
+ return True
def HandleExtra(self):
'''Deal with extra configuration detected'''