lp-set-dup: Don't crash when accessing private bugs (lp: #525539)

This commit is contained in:
Michael Bienia 2010-02-23 00:33:13 +01:00
parent 3df7282fc5
commit 16addfa5ff
2 changed files with 22 additions and 4 deletions

3
debian/changelog vendored
View File

@ -30,12 +30,13 @@ ubuntu-dev-tools (0.93) UNRELEASED; urgency=low
* Add support for the other LP service roots (edge is still default)
* Depend on python-launchpadlib >= 1.5.4
* Also check package sets for upload permissions.
* lp-set-dup: Don't crash when accessing private bugs (lp: #525539)
[ Michael Vogt ]
* edit-patch: add wrapper around cdbs-edit-patch, dpatch-edit-patch, quilt
to transparently deal with the various patch systems.
-- Michael Bienia <geser@ubuntu.com> Sat, 20 Feb 2010 18:38:17 +0100
-- Michael Bienia <geser@ubuntu.com> Tue, 23 Feb 2010 00:31:19 +0100
ubuntu-dev-tools (0.92) lucid; urgency=low

View File

@ -22,10 +22,12 @@
# Authors:
# Loïc Minier <lool@dooz.org>
import os, sys
import sys
from optparse import OptionParser
import ubuntutools.lp.libsupport as lp_libsupport
from launchpadlib.errors import HTTPError
def die(message):
print >> sys.stderr, "Fatal: " + message
@ -56,7 +58,14 @@ if __name__ == '__main__':
die("Couldn't setup Launchpad for the ubuntu-dev-tools consumer; %s" % (suggestion, ))
# check that the new main bug isn't a duplicate
new_main_bug = launchpad.bugs[args[0]]
try:
new_main_bug = launchpad.bugs[args[0]]
except HTTPError, error:
if error.response.status == 401:
print >> sys.stderr, "E: Don't have enough permissions to access bug %s" % (args[0])
die(error.content)
else:
raise
new_main_dup_of = new_main_bug.duplicate_of
if new_main_dup_of is not None:
s = None
@ -72,7 +81,15 @@ if __name__ == '__main__':
bugs_to_process = []
for b in args[1:]:
print "Processing %s" % (b)
bug = launchpad.bugs[b]
try:
bug = launchpad.bugs[b]
except HTTPError, error:
if error.response.status == 401:
print >> sys.stderr, "W: Don't have enough permissions to access bug %s" % (b)
print >> sys.stderr, "W: %s" % (error.content)
continue
else:
raise
dups = bug.duplicates
if dups is not None:
bugs_to_process.extend(dups)