Author: gnichols
Date: 2010-02-01 13:49:48 +0000 (Mon, 01 Feb 2010)
New Revision: 360
Modified:
trunk/v7/commandLineUI.py
trunk/v7/hardwaretest.py
Log:
560635 - info test fails due to difficulties in parsing /etc/redhat-release
Modified: trunk/v7/commandLineUI.py
===================================================================
--- trunk/v7/commandLineUI.py 2010-02-01 13:49:28 UTC (rev 359)
+++ trunk/v7/commandLineUI.py 2010-02-01 13:49:48 UTC (rev 360)
@@ -18,9 +18,7 @@
from v7.tags import Constants
-class CommandLineUI:
-
-
+class CommandLineUI:
# utilities
def printPipe(self, pipe):
while 1:
@@ -69,16 +67,5 @@
return self.promptConfirm(question=("%s - continue? " % message))
- def getRedHatRelease(self):
- f=open("/etc/redhat-release")
- line=f.readline()
- f.close()
- if line:
- pattern = re.compile("^(?P<product>[a-zA-Z\ ]+)release
(?P<number>[1-9\.]+) \((?P<name>[a-zA-Z0-9\ ]+)\)")
- match = pattern.match(line)
- product = None
- if match.group("product"):
- product = match.group("product").strip()
- return (product, match.group("number"),
match.group("name"))
- return (None, None, None)
+
Modified: trunk/v7/hardwaretest.py
===================================================================
--- trunk/v7/hardwaretest.py 2010-02-01 13:49:28 UTC (rev 359)
+++ trunk/v7/hardwaretest.py 2010-02-01 13:49:48 UTC (rev 360)
@@ -42,6 +42,7 @@
from v7.device import Device, HalDevice
from v7.command import Command, V7CommandException
from v7.resultsengine import ResultsEngine
+from v7.redhatrelease import RedHatRelease
class HardwareTestHarness(Controller):
@@ -220,15 +221,15 @@
print "Hardware: %s %s %s" %
(self.certification.getHardware(Tags.vendor),
self.certification.getHardware(Tags.make),
self.certification.getHardware(Tags.model))
- (product, name, number) = self.getRedHatRelease()
- self.certification.setOS(Tags.name, name)
- if number:
- self.certification.setOS(Tags.release, number)
+ redHatRelease = RedHatRelease()
+ self.certification.setOS(Tags.name, redHatRelease.getCodeName())
+ if redHatRelease.getVersionPointUpdate():
+ self.certification.setOS(Tags.release,
redHatRelease.getVersionPointUpdate())
else:
print "Error: could not determine OS release number"
return False
- if product:
- self.certification.setOS(Tags.product, product)
+ if redHatRelease.getProduct():
+ self.certification.setOS(Tags.product, redHatRelease.getProduct())
else:
print "Error: could not determine OS product name"
return False
Show replies by date