Author: gnichols
Date: 2012-03-09 12:27:54 +0000 (Fri, 09 Mar 2012)
New Revision: 1214
Modified:
trunk/v7/hardwaretest.py
Log:
782191 - FEAT: v7 should be able to open a new certification request
Modified: trunk/v7/hardwaretest.py
===================================================================
--- trunk/v7/hardwaretest.py 2012-03-09 12:27:08 UTC (rev 1213)
+++ trunk/v7/hardwaretest.py 2012-03-09 12:27:54 UTC (rev 1214)
@@ -29,7 +29,7 @@
from optparse import OptionParser
from v7.controller import Controller
-from v7.tags import Tags, Attributes, Constants, TestTag
+from v7.tags import Tags, Attributes, Constants, TestTag, SystemCategories
from v7.environment import Environment
from v7.certificationtest import ResultsDocument, CertificationDocument
from v7.testdocument import TestDocument
@@ -47,6 +47,7 @@
from v7.daemon import V7Daemon
from v7.log import Log
from v7.http import V7Http
+from v7.catalog import Catalog
class HardwareTestHarness(Controller):
@@ -993,6 +994,12 @@
def __submit(self):
if self.certification and self.certification.getNumberOfTestRuns() > 0:
+ if self.options.mode != Constants.auto:
+ # offer to open a certification in the catalog if there's no id on the results
+ catalog = Catalog()
+ if catalog.isReachable() and self.certification.getCertificationID() <= 0:
+ catalog.openCertification(self.certification)
+
report = Report(self.options, self.certification)
if report.WriteResultsRPM(self.environment.getLogDirectory()):
self.__save()
@@ -1054,7 +1061,7 @@
if self.testServer == "unknown":
self.testServer = None
- if self.testServer and (self.options.mode == Constants.auto or self.ui.promptConfirm("Copy results to test server %s?" % self.testServer)):
+ if self.testServer and (self.options.mode == Constants.auto or self.ui.promptConfirm("\nCopy results to test server %s?" % self.testServer)):
request = V7Http(self.testServer, "/v7/cgi/saveFile.py")
request.addField("server-path", serverPath)
return request.httpUpload(savedFilePath+".gz")
@@ -1384,22 +1391,37 @@
print e
def editCertification(self):
- editable = [Tags.vendor, Tags.make, Tags.model]
+ editable = [ Tags.vendor, Tags.make, Tags.model, Tags.product_url]
+ print "\nPlease verify the hardware product information:"
for tag in editable:
value = self.certification.getHardware(tag)
- answers = list()
- answers.append(value)
- value = self.ui.prompt("Please enter the %s:" % tag, answers)
+ value = self.ui.promptEdit(" %s:" % tag, value)
if len(value) > 0:
self.certification.setHardware(tag, value)
+ # category
+ answers = SystemCategories.getAll()
+ value = self.certification.getHardware(Tags.category)
+ value = self.ui.promptEdit(" " + Tags.category, value, answers)
+ if len(value) > 0:
+ self.certification.setHardware(Tags.category, value)
+
+
certificationID = self.certification.getCertificationID()
answers = None
if certificationID:
answers = list()
- answers.append(certificationID)
- value = self.ui.prompt("Please enter the certification ID:", answers)
- if len(value) > 0:
+ answers.append(str(certificationID))
+ while True:
+ value = self.ui.prompt("\nPlease enter the certification ID:", answers)
+ if not value:
+ break
+ try:
+ int(value)
+ break
+ except ValueError:
+ print "Error: %s is not an integer." % value
+ if value and int(value) >= 0:
self.certification.setCertificationID(value)