FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Fedora Development

 
 
LinkBack Thread Tools
 
Old 10-31-2008, 06:47 PM
Chris Lumens
 
Default - more save to bugzilla error checking

Used to be that "ppc" was not a valid platform in bugzilla but "powerpc"
was. Of course, rpmUtils.arch.getBaseArch returned the former. Well
that's been corrected in our bugzilla now, but this patch is still valid
as far as I'm concerned.

This checks the platform and sets it to All if rpmUtils returns
something that bugzilal doesn't understand, and checks that
product.productName also exists in bugzilla. It's up to the install
class to give us a useful backup there, just like it is with the
version.

- Chris


diff --git a/exception.py b/exception.py
index 70b61c0..e4e7c08 100644
--- a/exception.py
+++ b/exception.py
@@ -408,9 +408,8 @@ def saveToBugzilla(anaconda, exn, dest):
if buglist is None:
return False

- # FIXME: need to handle all kinds of errors here
if len(buglist) == 0:
- bug = withBugzillaDo(filer, lambda b: b.createbug(product=product.productName,
+ bug = withBugzillaDo(filer, lambda b: b.createbug(product=filer.getproduct(product.produ ctName),
component="anaconda",
version=filer.getversion(product.productVersion,
product.productName),
diff --git a/filer.py b/filer.py
index e8431ea..74e8461 100644
--- a/filer.py
+++ b/filer.py
@@ -66,7 +66,7 @@ class AbstractFiler(object):
ValueError -- For all other operations where the client
supplied values are not correct.
"""
- def __init__(self, bugUrl=None, develVersion=None):
+ def __init__(self, bugUrl=None, develVersion=None, defaultProduct=None):
"""Create a new AbstractFiler instance. This method need not be
overridden by subclasses.

@@ -75,6 +75,9 @@ class AbstractFiler(object):
the development version. This is used in case
anaconda attempts to file bugs against invalid
versions. It need not be set.
+ defaultProduct -- The product bugs should be filed against, should
+ anaconda get an invalid product name from the
+ boot media. This must be set.
"""
self.bugUrl = bugUrl
self.develVersion = develVersion
@@ -109,6 +112,14 @@ class AbstractFiler(object):
"""
raise NotImplementedError

+ def getproduct(self, prod):
+ """Verify that prod is a valid product name. If it is, return that
+ same product name. If not, return self.defaultProduct. This method
+ queries the bug filing system for a list of valid products. It must
+ be provided by all subclasses.
+ """
+ raise NotImplementedError
+
def getversion(self, ver, prod):
"""Verify that ver is a valid version number for the product name prod.
If it is, return that same version number. If not, return
@@ -286,8 +297,9 @@ class BugzillaFiler(AbstractFiler):
except socket.error, e:
raise CommunicationError(str(e))

- def __init__(self, bugUrl=None, develVersion=None):
- AbstractFiler.__init__(self, bugUrl=bugUrl, develVersion=develVersion)
+ def __init__(self, bugUrl=None, develVersion=None, defaultProduct=None):
+ AbstractFiler.__init__(self, bugUrl=bugUrl, develVersion=develVersion,
+ defaultProduct=defaultProduct)
self._bz = None

def login(self, username, password):
@@ -310,6 +322,11 @@ class BugzillaFiler(AbstractFiler):
whiteboards.append((wb, val))
kwargs.pop(key)

+ if key == "platform":
+ platformLst = self.__withBugzillaDo(lambda b: b._proxy.Bug.legal_values({'field': 'platform'}))
+ if not val in platformLst:
+ kwargs[key] = "All"
+
bug = self.__withBugzillaDo(lambda b: b.createbug(**kwargs))
for (wb, val) in whiteboards:
bug.setwhiteboard(val, which=wb)
@@ -323,6 +340,16 @@ class BugzillaFiler(AbstractFiler):
lst = self.__withBugzillaDo(lambda b: b.getbugs(idlist))
return map(lambda b: BugzillaBug(self, bug=b), lst)

+ def getproduct(self, prod):
+ details = self.__withBugzillaDo(lambda b: b.getproducts())
+ if prod not in details.keys():
+ if self.defaultProduct:
+ return self.defaultProduct
+ else:
+ raise ValueError, "The product %s is not valid and no defaultProduct is set." % prod
+ else:
+ return prod
+
def getversion(self, ver, prod):
details = self.__withBugzillaDo(lambda b: b._proxy.bugzilla.getProductDetails(prod))
bugzillaVers = details[1]
diff --git a/installclasses/fedora.py b/installclasses/fedora.py
index bf26459..3554043 100644
--- a/installclasses/fedora.py
+++ b/installclasses/fedora.py
@@ -50,7 +50,7 @@ class InstallClass(BaseInstallClass):
(N_("Web Server"), ["web-server"])]

bugFiler = BugzillaFiler(bugUrl="https://bugzilla.redhat.com/xmlrpc.cgi",
- develVersion="rawhide")
+ develVersion="rawhide", defaultProduct="Fedora")

def getPackagePaths(self, uri):
if not type(uri) == types.ListType:

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 10-31-2008, 07:16 PM
Jeremy Katz
 
Default - more save to bugzilla error checking

On Fri, 2008-10-31 at 15:47 -0400, Chris Lumens wrote:
> Used to be that "ppc" was not a valid platform in bugzilla but "powerpc"
> was. Of course, rpmUtils.arch.getBaseArch returned the former. Well
> that's been corrected in our bugzilla now, but this patch is still valid
> as far as I'm concerned.
>
> This checks the platform and sets it to All if rpmUtils returns
> something that bugzilal doesn't understand, and checks that
> product.productName also exists in bugzilla. It's up to the install
> class to give us a useful backup there, just like it is with the
> version.

Looks okay -- one minor nit

> diff --git a/filer.py b/filer.py
> index e8431ea..74e8461 100644
> --- a/filer.py
> +++ b/filer.py
> @@ -310,6 +322,11 @@ class BugzillaFiler(AbstractFiler):
> whiteboards.append((wb, val))
> kwargs.pop(key)
>
> + if key == "platform":
> + platformLst = self.__withBugzillaDo(lambda b: b._proxy.Bug.legal_values({'field': 'platform'}))
> + if not val in platformLst:
> + kwargs[key] = "All"

Is All guaranteed to be in the list? Obviously it is in our bugzilla,
but maybe we should fall back to gettin ga list of platforms (is that
even possible) and just chucking in the first one? We should at least
verify that All is valid and give a nice error like we do for other
cases

Jeremy

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 10-31-2008, 07:21 PM
Chris Lumens
 
Default - more save to bugzilla error checking

> Is All guaranteed to be in the list? Obviously it is in our bugzilla,
> but maybe we should fall back to gettin ga list of platforms (is that
> even possible) and just chucking in the first one? We should at least
> verify that All is valid and give a nice error like we do for other
> cases

I don't know whether All is guaranteed to be there or not. The
legal_values call actually does return a list, and All is the first
element of it in RH bugzilla. So it'd be easy to just use the first
element. I'll go ahead and make that change.

- Chris

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 

Thread Tools




All times are GMT. The time now is 11:24 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org