Author: gnichols Date: 2010-05-28 14:27:44 +0000 (Fri, 28 May 2010) New Revision: 517
Modified: trunk/tests/info/info.py Log: 591357 - RHEL6 info test: no --no-progressbar option for sosreport
Modified: trunk/tests/info/info.py =================================================================== --- trunk/tests/info/info.py 2010-05-26 14:43:06 UTC (rev 516) +++ trunk/tests/info/info.py 2010-05-28 14:27:44 UTC (rev 517) @@ -313,17 +313,32 @@
def generateSystemReport(self): - outputDirectory = os.getcwd() - reportCommand = "sosreport -n selinux" - if "Red Hat" in self.redHatRelease.getProduct(): - if self.redHatRelease.getVersion() == 4: - reportCommand = "sysreport" - elif self.redHatRelease.getVersion() == 5: - reportCommand = reportCommand + " --no-progressbar" - - pipe = os.popen("echo -e '\n\n' | %s -k rpm.rpmva=off 2>&1" % reportCommand) - result = False - while True: + + result = False + # for RHEL 4, use sysreport + if "Red Hat" in self.redHatRelease.getProduct() and self.redHatRelease.getVersion() == 4: + result = self.__processSystemReport("sysreport") + # otherwise, uses sosreport + else: + # try --no-progressbar for some RHEL5's + result = self.__processSystemReport("sosreport -n selinux --no-progressbar") + # if that fails, leave off --no-progressbar + if not result: + result = self.__processSystemReport("sosreport -n selinux") + + + dmidecode = "/usr/sbin/dmidecode" + if os.path.exists(dmidecode): + if not os.system(dmidecode) is 0: + print "Note: %s returned an error." % (dmidecode) + + + return result + + def __processSystemReport(self, reportCommand): + pipe = os.popen("echo -e '\n\n' | %s -k rpm.rpmva=off 2>&1" % reportCommand) + result = False + while True: line = pipe.readline() if line: print line.strip() @@ -339,7 +354,8 @@ print tarFile sys.stdout.flush()
- if tarFile: + if tarFile: + outputDirectory = os.getcwd() shutil.copy(tarFile, outputDirectory) print "Copied %s %s to %s" % (reportCommand, tarFile, outputDirectory) sys.stdout.flush() @@ -347,15 +363,8 @@ break else: break - pipe.close() - - dmidecode = "/usr/sbin/dmidecode" - if os.path.exists(dmidecode): - if not os.system(dmidecode) is 0: - print "Note: %s returned an error." % (dmidecode) - - - return result + pipe.close() + return result
def run(self):
v7-commits@lists.stg.fedorahosted.org