r1219 - trunk/v7
by gnichols@fedoraproject.org
Author: gnichols
Date: 2012-03-09 12:30:38 +0000 (Fri, 09 Mar 2012)
New Revision: 1219
Modified:
trunk/v7/environment.py
Log:
782191 - FEAT: v7 should be able to open a new certification request\n 799921 - v7 1.5 R7 may trace-back on older /etc/v7.xml environment file.
Modified: trunk/v7/environment.py
===================================================================
--- trunk/v7/environment.py 2012-03-09 12:28:59 UTC (rev 1218)
+++ trunk/v7/environment.py 2012-03-09 12:30:38 UTC (rev 1219)
@@ -48,6 +48,7 @@
self.defaultResultsWarningSize = 12 * 1048576 # bytes
self.defaultFVGuestTimelimit = 60 # minutes
self.defaultRebootTimelimit = 10 # minutes
+ self.defaultCatalogURL="http://hwcert-web2-test.devel.redhat.com/xmlrpc.cgi"
try:
self.load(self.environmentFile)
@@ -100,6 +101,8 @@
self.setTextNode(element, self.defaultGuestBootDirectory)
element = self.findOrCreateElement(urlElement, Tags.partner_server)
self.setTextNode(element, self.defaultPartnerServerURL)
+ element = self.findOrCreateElement(urlElement, Tags.catalog_url)
+ self.setTextNode(element, self.defaultCatalogURL)
timeLimitsElement = self.findOrCreateElement(self.document.documentElement, Tags.time_limits)
timeLimitsElement.setAttribute(Attributes.fv_guest_timelimit, "%u" % self.defaultFVGuestTimelimit)
@@ -185,6 +188,8 @@
def getCertificationFileName(self):
dataDirectoryElement = self.findOrCreateElement(self._getFilesystemElement(), Tags.data_directory)
+ if not dataDirectoryElement.getAttribute(Attributes.certification_name):
+ return self.defaultCertificationName
return dataDirectoryElement.getAttribute(Attributes.certification_name)
def getLockFile(self):
@@ -236,6 +241,12 @@
def getPartnerServerURL(self):
element = self.findOrCreateElement(self._getURLsElement(), Tags.partner_server)
return self.getTextNode(element).data
+
+ def getCatalogURL(self):
+ element = self.findOrCreateElement(self._getURLsElement(), Tags.catalog_url)
+ if not self.getTextNode(element) or not self.getTextNode(element).data:
+ return self.defaultCatalogURL
+ return self.getTextNode(element).data
def getMaximumAttachmentSize(self):
return string.atoi(self._getFilesystemElement().getAttribute(Attributes.maximum_attachment_size))
12 years, 2 months
r1218 - trunk/v7
by gnichols@fedoraproject.org
Author: gnichols
Date: 2012-03-09 12:28:59 +0000 (Fri, 09 Mar 2012)
New Revision: 1218
Modified:
trunk/v7/commandLineUI.py
Log:
782191 - FEAT: v7 should be able to open a new certification request
Modified: trunk/v7/commandLineUI.py
===================================================================
--- trunk/v7/commandLineUI.py 2012-03-09 12:28:45 UTC (rev 1217)
+++ trunk/v7/commandLineUI.py 2012-03-09 12:28:59 UTC (rev 1218)
@@ -14,7 +14,7 @@
# Author: Greg Nichols
#
import string, os, sys, copy, re
-import readline
+import readline, getpass
from tags import Constants
@@ -42,9 +42,13 @@
sys.stdout.write("response: %s" % response)
return response.strip()
- def promptInteger(self, question):
+ def promptInteger(self, question, answers=None):
while True:
sys.stdout.write(question)
+ if answers:
+ sys.stdout.write(" (")
+ sys.stdout.write("|".join(answers))
+ sys.stdout.write(") ")
sys.stdout.flush()
response = sys.stdin.readline()
try:
@@ -74,14 +78,21 @@
return self.promptConfirm(question=("%s - continue? " % message))
- def promptEdit(self, label, value):
+ def promptEdit(self, label, value, answers=None):
if not value:
value = ""
+ if answers:
+ label += " ("
+ label += "|".join(answers)
+ label += ") "
readline.set_startup_hook(lambda: readline.insert_text(value))
try:
return raw_input(label)
finally:
readline.set_startup_hook()
+
+ def promptPassword(self, message):
+ return getpass.getpass(message)
12 years, 2 months
r1217 - trunk/v7
by gnichols@fedoraproject.org
Author: gnichols
Date: 2012-03-09 12:28:45 +0000 (Fri, 09 Mar 2012)
New Revision: 1217
Added:
trunk/v7/catalog.py
Log:
782191 - FEAT: v7 should be able to open a new certification request
Added: trunk/v7/catalog.py
===================================================================
--- trunk/v7/catalog.py (rev 0)
+++ trunk/v7/catalog.py 2012-03-09 12:28:45 UTC (rev 1217)
@@ -0,0 +1,81 @@
+# Copyright (c) 2012 Red Hat, Inc. All rights reserved. This copyrighted material
+# is made available to anyone wishing to use, modify, copy, or
+# redistribute it subject to the terms and conditions of the GNU General
+# Public License v.2.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# Author: Greg Nichols
+#
+# Catalog is the client-side python interface to the hardware catalog web site,
+
+# Notes:
+# The catalog instance (server URL) is taken from the enviroment (/etc/v7.xml).
+
+import xmlrpclib
+import urllib2
+
+from v7.controller import Controller
+from v7.environment import Environment
+from v7.tags import Tags
+
+class Catalog(Controller):
+
+ def __init__(self):
+ Controller.__init__(self)
+ self.environment = Environment()
+
+ def isReachable(self):
+ """ check to see that the catalog server is reachable """
+ catalogServer = self.environment.getCatalogURL()
+ # get just the server URL by stripping off the end of the URL (find the / at least 7 characters from the left).
+ catalogServer = catalogServer[0:catalogServer.index('/', 7)]
+ try:
+ request = urllib2.urlopen(catalogServer)
+ except Exception, e:
+ print "Could not reach catalog server %s" % catalogServer
+ print e
+ return False
+ return True
+
+ def openCertification(self, certificationDocument):
+
+ if not self.ui.promptConfirm("\nWould you like to open a new certification request?"):
+ return None
+
+ tags = [Tags.make, Tags.model, Tags.vendor, Tags.category, Tags.product_url, Tags.arch]
+ hardware = dict()
+ for tag in tags:
+ hardware[tag] = certificationDocument.getHardware(tag)
+
+ # get the RHEL version
+ rhelVersion = certificationDocument.getOS(Tags.release)
+
+ login = self.ui.prompt("Red Hat Catalog User Name: ")
+ password = self.ui.promptPassword("Password: ")
+
+ serverProxy = xmlrpclib.ServerProxy(self.environment.getCatalogURL())
+ try:
+ certificationID = serverProxy.Cert.create(login, password,
+ hardware[Tags.make], hardware[Tags.model], hardware[Tags.vendor], rhelVersion,
+ hardware[Tags.arch], hardware[Tags.category], hardware[Tags.product_url])
+
+ except xmlrpclib.Fault, error:
+ print "Error: could not open a new certification:"
+ print " Fault code: %d" % error.faultCode
+ print " Fault string: %s" % error.faultString
+ return None
+ except Exception, e:
+ print "Error: could not open a new certification:"
+ print e
+ return None
+
+ certificationDocument.setCertificationID(certificationID)
+
+ return certificationID
12 years, 2 months
r1216 - trunk/v7
by gnichols@fedoraproject.org
Author: gnichols
Date: 2012-03-09 12:28:29 +0000 (Fri, 09 Mar 2012)
New Revision: 1216
Modified:
trunk/v7/tags.py
Log:
782191 - FEAT: v7 should be able to open a new certification request
Modified: trunk/v7/tags.py
===================================================================
--- trunk/v7/tags.py 2012-03-09 12:28:14 UTC (rev 1215)
+++ trunk/v7/tags.py 2012-03-09 12:28:29 UTC (rev 1216)
@@ -69,6 +69,9 @@
v7_image="v7-image"
time_limits="time-limits"
v7_kernel_info="v7-kernel-info"
+ product_url="product-url"
+ catalog_url="catalog-url"
+ category="category"
class Attributes:
@@ -114,6 +117,7 @@
kernel="kernel"
certification_name="certification-name"
id="id"
+ catalog_url="catalog-url"
class Constants:
PASS="PASS"
@@ -250,6 +254,19 @@
tags.append(vars(TestTag)[key])
return tags
-
-
+class SystemCategories:
+ """ Hardware Catalog System Categories """
+ Server="Server"
+ DesktopWorkstation="Desktop/Workstation"
+ Laptop="Laptop"
+ ComponentPeripheral="Component/Peripheral"
+ @staticmethod
+ def getAll():
+ categories=list()
+ for key in vars(SystemCategories):
+ if "_" not in key and "getAll" not in key:
+ categories.append(vars(SystemCategories)[key])
+ return categories
+
+
12 years, 2 months
r1215 - trunk/v7
by gnichols@fedoraproject.org
Author: gnichols
Date: 2012-03-09 12:28:14 +0000 (Fri, 09 Mar 2012)
New Revision: 1215
Modified:
trunk/v7/certificationtest.py
Log:
782191 - FEAT: v7 should be able to open a new certification request
Modified: trunk/v7/certificationtest.py
===================================================================
--- trunk/v7/certificationtest.py 2012-03-09 12:27:54 UTC (rev 1214)
+++ trunk/v7/certificationtest.py 2012-03-09 12:28:14 UTC (rev 1215)
@@ -85,11 +85,16 @@
def setCertificationID(self, id):
certificationElement = self.findOrCreateElement(self.document.documentElement, Tags.certification)
- certificationElement.setAttribute(Attributes.id, id)
+ # throw ValueError if not an int
+ int(id)
+ certificationElement.setAttribute(Attributes.id, str(id))
def getCertificationID(self):
certificationElement = self.findOrCreateElement(self.document.documentElement, Tags.certification)
- return certificationElement.getAttribute(Attributes.id)
+ try:
+ return int(certificationElement.getAttribute(Attributes.id))
+ except ValueError:
+ return 0
def getOSProductShortName(self):
longName = self.getOS(Tags.product)
12 years, 2 months
r1214 - trunk/v7
by gnichols@fedoraproject.org
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)
12 years, 2 months
r1213 - trunk
by gnichols@fedoraproject.org
Author: gnichols
Date: 2012-03-09 12:27:08 +0000 (Fri, 09 Mar 2012)
New Revision: 1213
Modified:
trunk/Makefile
Log:
R8
Modified: trunk/Makefile
===================================================================
--- trunk/Makefile 2012-03-02 19:37:43 UTC (rev 1212)
+++ trunk/Makefile 2012-03-09 12:27:08 UTC (rev 1213)
@@ -14,7 +14,7 @@
# Author: Greg Nichols
V7_VERSION := 1.5
-V7_RELEASE := 7
+V7_RELEASE := 8
V7_VERSION_RELEASE := $(V7_VERSION)-$(V7_RELEASE)
V7_VERSION_PY := v7/version.py
V7_SVN_MODULE := svn+ssh://svn.fedorahosted.org/svn/v7
12 years, 2 months
r1212 - tags
by gnichols@fedoraproject.org
Author: gnichols
Date: 2012-03-02 19:37:43 +0000 (Fri, 02 Mar 2012)
New Revision: 1212
Added:
tags/v7-V1-5R7/
Log:
tag version
12 years, 2 months
r1211 - trunk/v7
by gnichols@fedoraproject.org
Author: gnichols
Date: 2012-03-02 19:37:18 +0000 (Fri, 02 Mar 2012)
New Revision: 1211
Modified:
trunk/v7/redhatrelease.py
Log:
532557 - test suite should alarm operator and fail test runs on non GA kernel
Modified: trunk/v7/redhatrelease.py
===================================================================
--- trunk/v7/redhatrelease.py 2012-03-02 19:36:19 UTC (rev 1210)
+++ trunk/v7/redhatrelease.py 2012-03-02 19:37:18 UTC (rev 1211)
@@ -100,14 +100,14 @@
self.kernelVersionRelease = match.group("versionRelease")
elif "Red Hat" in self.getProduct() and self.getVersion() >= 5:
- pattern = re.compile("(?P<versionRelease>.*)(?P<product>el[0-9]+)(?P<flavor>xen|PAE|rt)?(?P<arch>.*)$")
+ pattern = re.compile("(?P<versionRelease>.*)\.(?P<product>el[0-9]+)(?P<flavor>xen|PAE|rt)?(?P<arch>.*)$")
match = pattern.search(unameOutput)
if match:
flavor = ""
if match.group("flavor"):
self.kernelFlavor = match.group("flavor")
flavor = "%s-" % match.group("flavor")
- self.kernelRPMName = "kernel-%s%s%s" % (flavor, match.group("versionRelease"), match.group("product"))
+ self.kernelRPMName = "kernel-%s%s.%s" % (flavor, match.group("versionRelease"), match.group("product"))
self.kernelDevelRPMName = "kernel-%sdevel" % flavor
# RT kernel tags rt on the end of el5
if match.group("flavor") == "rt":
@@ -116,10 +116,10 @@
self.kernelVersionRelease = match.group("versionRelease")
elif 'Fedora' in self.getProduct():
- pattern = re.compile("(?P<versionRelease>.*)(?P<product>fc[0-9]+)(?P<arch>.*)$")
+ pattern = re.compile("(?P<versionRelease>.*)\.(?P<product>fc[0-9]+)(?P<arch>.*)$")
match = pattern.search(unameOutput)
if match:
- self.kernelRPMName = "kernel-%s%s%s" % (match.group("versionRelease"), match.group("product"), match.group("arch"))
+ self.kernelRPMName = "kernel-%s.%s%s" % (match.group("versionRelease"), match.group("product"), match.group("arch"))
self.kernelVersionRelease = match.group("versionRelease")
if not self.kernelRPMName:
@@ -178,6 +178,7 @@
print "Version: \"" + str(self.getVersion()) + "\""
print "Update: \"" + str(self.getUpdate()) + "\""
print "Version.Update \"" + self.getVersionPointUpdate() + "\""
+ print "Kernel Version \"" + self.getKernelVersionRelease() + "\""
if self.candidate:
print "Candidate: \"" + self.getCandidate() + "\""
print "Code Name: \"" + self.getCodeName() + "\""
12 years, 2 months
r1210 - trunk
by gnichols@fedoraproject.org
Author: gnichols
Date: 2012-03-02 19:36:19 +0000 (Fri, 02 Mar 2012)
New Revision: 1210
Modified:
trunk/v7.spec.in
Log:
changelog
Modified: trunk/v7.spec.in
===================================================================
--- trunk/v7.spec.in 2012-03-02 19:35:52 UTC (rev 1209)
+++ trunk/v7.spec.in 2012-03-02 19:36:19 UTC (rev 1210)
@@ -81,7 +81,7 @@
%changelog
* Fri Feb 03 2012 Greg Nichols <gnichols(a)redhat.com>
-V7 1.5 R6
+V7 1.5 R7
782229 - FEAT: v7 certify should support component mode
782195 - FEAT: v7 certify should only run rtevel and hwlatdetect (and info) on the RT kernel
12 years, 2 months