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
commitd354eef636b2ecc48ed82a1e4596033f60f0555b (patch)
tree34c478bfdce529e4efd5a2a257879e72629f047b /src
parenta7d2bd259eb85db95905d78bb598a14ab0d4a8bc (diff)
downloadbcfg2-d354eef636b2ecc48ed82a1e4596033f60f0555b.tar.gz
bcfg2-d354eef636b2ecc48ed82a1e4596033f60f0555b.tar.bz2
bcfg2-d354eef636b2ecc48ed82a1e4596033f60f0555b.zip
typo
2005/10/24 05:05:17-05:00 anl.gov!desai simplify 2005/10/24 05:00:05-05:00 anl.gov!desai pylint fixes 2005/10/24 04:56:20-05:00 anl.gov!desai fix package contents verification bug 2005/10/24 04:45:01-05:00 anl.gov!desai remove Popen4 duplication (Logical change 1.343) git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@1421 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src')
-rw-r--r--src/lib/Client/Solaris.py30
1 files changed, 10 insertions, 20 deletions
diff --git a/src/lib/Client/Solaris.py b/src/lib/Client/Solaris.py
index 2ac09a119..ef4e3d946 100644
--- a/src/lib/Client/Solaris.py
+++ b/src/lib/Client/Solaris.py
@@ -4,11 +4,10 @@ __revision__ = '$Revision$'
from glob import glob
from os import popen, stat, system, unlink
-from popen2 import Popen4
from re import compile as regcompile
from tempfile import mktemp
-from Bcfg2.Client.Toolset import Toolset
+from Bcfg2.Client.Toolset import Toolset, saferun
noask = '''
mail=
@@ -60,10 +59,8 @@ class Solaris(Toolset):
instp = popen("/usr/bin/pkginfo -x")
lines = instp.readlines()
while (lines):
- l1 = lines.pop()
- l2 = lines.pop()
- name = l2.split()[0]
- version = l1.split()[1]
+ version = lines.pop().split()[1]
+ name = lines.pop().split()[0]
self.installed[name] = version
self.ptypes[name] = 'sysv'
# try to find encap packages
@@ -126,10 +123,7 @@ class Solaris(Toolset):
print "Enabling Service %s" % (entry.attrib['name'])
else:
cmdrc = system("/usr/sbin/svcadm enable -r %s" % (entry.attrib['FMRI']))
- if cmdrc == 0:
- return True
- else:
- return False
+ return cmdrc == 0
def VerifyPackage(self, entry, modlist):
'''Verify Package status for entry'''
@@ -148,26 +142,21 @@ class Solaris(Toolset):
if entry.attrib.get('verify', 'true') == 'true':
if self.setup['quick'] or entry.get('type') == 'encap':
return True
- verp = Popen4("/usr/sbin/pkgchk -n %s" % (entry.get('name')), 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[:5] == 'ERROR']
+ (vstat, odata) = saferun("/usr/sbin/pkgchk -n %s" % (entry.get('name')))
if vstat == 0:
return True
else:
+ output = [line for line in odata if line[:5] == 'ERROR']
if len([name for name in output if name.split()[-1] not in modlist]):
- return True
- else:
self.CondPrint('debug', "Package %s content verification failed" % (entry.get('name')))
+ else:
+ return True
return False
def Inventory(self):
'''Do standard inventory plus debian extra service check'''
Toolset.Inventory(self)
- allsrv = [name for name, version in [ x.strip().split() for x in
+ allsrv = [name for name, version in [ srvc.strip().split() for srvc in
popen("/usr/bin/svcs -a -H -o FMRI,STATE").readlines() ]
if version != 'disabled']
csrv = self.cfg.findall(".//Service")
@@ -208,6 +197,7 @@ class Solaris(Toolset):
self.CondPrint('verbose', "Need to remove services: %s" % (self.extra_services))
def Install(self):
+ '''Local install method handling noaskfiles'''
Toolset.Install(self)
try:
unlink(self.noaskname)