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 > Debian > Debian Laptop

 
 
LinkBack Thread Tools
 
Old 07-22-2008, 05:23 PM
Chris Lumens
 
Default saving to bugzilla, redux

Here's another patch set to implement the saving to bugzilla feature. I'll
assume everyone remembers the discussion from earlier. If not, just go look
it up. This set is different from the first in the following ways:

* Saving via scp is back, and I redid the UI to be one of those drop downs
with the changing widget area underneath, a la Apple, instead of having
some super complicated single UI.

* There's now an intermediate abstraction layer, which you can see in the
"import filer" in various places. The idea here is that the InstallClass
has a reference to a bug filing class. The default BaseInstallClass just
uses an abstract one which isn't capable of doing anything. The RHEL and
Fedora InstallClasses then use a real one. That in turn makes use of
Will's python-bugzilla module.

I'll post the filer code as a followup to this thread. It's kind of lame, and
needs lots of comments and the like. Also I have no idea where it should
live since it's currently just a single little python file. If this is only
ever going to get used in anaconda, perhaps a subpackage or just living inside
the anaconda source. Otherwise, unknown.

Comments?

- Chris

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 07-22-2008, 05:25 PM
 
Default saving to bugzilla, redux

> I'll post the filer code as a followup to this thread. It's kind of lame, and
> needs lots of comments and the like. Also I have no idea where it should
> live since it's currently just a single little python file. If this is only
> ever going to get used in anaconda, perhaps a subpackage or just living inside
> the anaconda source. Otherwise, unknown.

As promised, here's the filer.py file. Enjoy.

- Chris


#!/usr/bin/python
#
# Copyright (C) 2008 Red Hat, Inc.
# All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# 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, see <http://www.gnu.org/licenses/>.
#
# Author(s): Chris Lumens <clumens@redhat.com>
#

# An abstraction to make various bug reporting systems all act the same. This
# library requires the use of other system-specific python modules to interact
# with the bug systems themselves. A disadvantage here is that we expect all
# systems to have a bugzilla-like interface for now. That could change as I
# see how more systems behave.

class LoginError(Exception):
"""An error occurred while logging into the bug reporting system."""
def __init__(self, bugUrl, username):
self.bugUrl = bugUrl
self.username = username

def __str__(self):
return "Could not login to %s with username %s" % (self.bugUrl, self.username)

class CommunicationError(Exception):
"""Some miscellaneous error occurred while communicating with the
bug reporting system. This could include XML-RPC errors, passing
bad data, or network problems."""
def __init__(self, msg):
self.msg = msg

def __str__(self):
return "Error communicating with bug system: %s" % self.msg

class AbstractFiler(object):
def __init__(self, bugUrl=None):
self.bugUrl = bugUrl

def login(self, username, password):
raise NotImplementedError

def createbug(self, check_args=False, *args, **kwargs):
raise NotImplementedError

def getbug(self, id):
raise NotImplementedError

def getbugs(self, idlist):
raise NotImplementedError

def query(self, query):
raise NotImplementedError

def supportsFiling(self):
return False

class AbstractBug(object):
def __init__(self, filer, *args, **kwargs):
self.filer = filer

def __str__(self):
raise NotImplementedError

def __repr__(self):
raise NotImplementedError

def __getattr__(self, name):
raise NotImplementedError

def __setattr__(self, name, val):
raise NotImplementedError

def addcomment(self, comment):
raise NotImplementedError

def attachfile(self, file, description, **kwargs):
raise NotImplementedError

def close(self, resolution, dupeid=0, comment='):
raise NotImplementedError

def setstatus(self, status, comment='):
raise NotImplementedError

def setassignee(self, assigned_to=', reporter=', comment='):
raise NotImplementedError

# Do all bug reporting systems have some sort of whiteboard?
def getwhiteboard(self, which='):
raise NotImplementedError

def appendwhiteboard(self, text, which='):
raise NotImplementedError

def prependwhitebaord(self, text, which='):
raise NotImplementedError

def setwhiteboard(self, text, which='):
raise NotImplementedError


class BugzillaFiler(AbstractFiler):
def __withBugzillaDo(self, fn):
import xmlrpclib
import socket

try:
retval = fn(self._bz)
return retval
except xmlrpclib.ProtocolError, e:
raise CommunicationError(str(e))
except xmlrpclib.Fault, e:
raise ValueError(str(e))
except socket.error, e:
raise CommunicationError(str(e))

def __init__(self, bugUrl=None):
AbstractFiler.__init__(self, bugUrl=bugUrl)
self._bz = None

def login(self, username, password):
import bugzilla

self._bz = bugzilla.Bugzilla(url=self.bugUrl)

retval = self._bz.login(username, password)
if not retval:
raise LoginError(self.bugUrl, username)

return retval

def createbug(self, check_args=False, *args, **kwargs):
whiteboards = []

for (key, val) in kwargs.items():
if key.endswith("_whiteboard"):
wb = key.split("_")[0]
whiteboards.push((wb, val))
kwargs.pop(key)

bug = self.__withBugzillaDo(lambda b: b.createbug(**kwargs))
for (wb, val) in whiteboards:
bug.setwhiteboard(val, which=wb)

return bug

def getbug(self, id):
return self.__withBugzillaDo(lambda b: b.getbug(id))

def getbugs(self, idlist):
return self.__withBugzillaDo(lambda b: b.getbugs(idlist))

def query(self, query):
return self.__withBugzillaDo(lambda b: b.query(query))

def supportsFiling(self):
return True

class BugzillaBug(AbstractBug):
def __withBugDo(self, fn):
import xmlrpclib
import socket

try:
retval = fn(self._bug)
return retval
except xmlrpclib.ProtocolError, e:
raise CommunicationError(str(e))
except xmlrpclib.Fault, e:
raise ValueError(str(e))
except socket.error, e:
raise CommunicationError(str(e))

def __init__(self, filer, *args, **kwargs):
import bugzilla

self.filer = filer
self._bug = bugzilla.Bug(self.filer, *args, **kwargs)

def __str__(self):
return self._bug.__str__()

def __repr__(self):
return self._bug.__repr__()

def __getattr__(self, name):
return self._bug.__getattr__(name)

def __setattr__(self, name, val):
raise NotImplementedError

def addcomment(self, comment):
return self.__withBugDo(lambda b: b.addcomment(comment))

def attachfile(self, file, description, **kwargs):
return self.__withBugDo(lambda b : b.attachfile(file, description, **kwargs))

def close(self, resolution, dupeid=0, comment='):
return self.__withBugDo(lambda b: b.close(resolution, dupeid=dupeid,
comment=comment))

def setstatus(self, status, comment='):
return self.__withBugDo(lambda b: b.setstatus(status, comment=comment))

def setassignee(self, assigned_to=', reporter=', comment='):
return self.__withBugDo(lambda b: b.setassignee(assigned_to=assigned_to,
reporter=reporter,
comment=comment))

def getwhiteboard(self, which='status'):
return self.__withBugDo(lambda b: b.getwhiteboard(which=which))

def appendwhiteboard(self, text, which='status'):
return self.__withBugDo(lambda b: b.appendwhiteboard(text, which=which))

def prependwhitebaord(self, text, which='status'):
return self.__withBugDo(lambda b: b.prependwhiteboard(text, which=which))

def setwhiteboard(self, text, which='status'):
return self.__withBugDo(lambda b: b.setwhiteboard(text, which=which))

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 07-22-2008, 06:39 PM
Jeremy Katz
 
Default saving to bugzilla, redux

On Tue, 2008-07-22 at 13:23 -0400, Chris Lumens wrote:
> * Saving via scp is back, and I redid the UI to be one of those drop downs
> with the changing widget area underneath, a la Apple, instead of having
> some super complicated single UI.

Screenshots?

> * There's now an intermediate abstraction layer, which you can see in the
> "import filer" in various places. The idea here is that the InstallClass
> has a reference to a bug filing class. The default BaseInstallClass just
> uses an abstract one which isn't capable of doing anything. The RHEL and
> Fedora InstallClasses then use a real one. That in turn makes use of
> Will's python-bugzilla module.
>
> I'll post the filer code as a followup to this thread. It's kind of lame, and
> needs lots of comments and the like. Also I have no idea where it should
> live since it's currently just a single little python file. If this is only
> ever going to get used in anaconda, perhaps a subpackage or just living inside
> the anaconda source. Otherwise, unknown.

I suspect that just dropping the filer class into anaconda for now makes
the most sense. And then if others want to use it, we can split it out.
Should be better than the other approach of "split it out because
someone might want it and then no one ever uses it"

My only other comment is does it make sense to give the hash some prefix
in case we change the hashing in the future? I guess it doesn't matter
as we can add a prefix later if we need and since that'll change the
length, it'll break matching. So never mind this part

But yeah, let's get this in. Then we can have it tested with the alpha!

Jeremy

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 07-22-2008, 07:37 PM
Chris Lumens
 
Default saving to bugzilla, redux

> > * Saving via scp is back, and I redid the UI to be one of those drop downs
> > with the changing widget area underneath, a la Apple, instead of having
> > some super complicated single UI.
>
> Screenshots?

How about http://clumens.fedorapeople.org/exn.ogg instead?

Ignore the part at the end where it directs you to
http://bugzilla.redhat.com/xmlrpc.cgi/446999. That's from a slightly
older version of my updates image that I for some reason didn't do the
screen capture against.

> I suspect that just dropping the filer class into anaconda for now makes
> the most sense. And then if others want to use it, we can split it out.
> Should be better than the other approach of "split it out because
> someone might want it and then no one ever uses it"

This is my favorite approach as well. I doubt anyone's really going to
want to use it any time soon, but it's entirely possible. Easy to split
things out later.

> My only other comment is does it make sense to give the hash some prefix
> in case we change the hashing in the future? I guess it doesn't matter
> as we can add a prefix later if we need and since that'll change the
> length, it'll break matching. So never mind this part

The test bug (446999) doesn't have it in the status whiteboard since
that was my first iteration of the patch late one afternoon, but we'll
be putting "anaconda_trace_hash:" at the beginning.

> But yeah, let's get this in. Then we can have it tested with the alpha!

I'll work on the final stuff related to filer.py (like a little better
organization) and get this all committed.

- 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 12:55 PM.

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