* requestsync: Catch credentials error to hide traceback.

This commit is contained in:
Jonathan Davies 2009-01-17 11:14:40 +00:00
parent dce63c4fb7
commit 152220567d
3 changed files with 10 additions and 0 deletions

View File

@ -290,6 +290,7 @@ def find_credentials(consumer, files, level=None):
continue continue
if cred.consumer.key == consumer: if cred.consumer.key == consumer:
return cred return cred
raise IOError("No credentials found for '%s', please see the " \ raise IOError("No credentials found for '%s', please see the " \
"manage-credentials manpage for help on how to create " \ "manage-credentials manpage for help on how to create " \
"one for this consumer." % consumer) "one for this consumer." % consumer)

1
debian/changelog vendored
View File

@ -4,6 +4,7 @@ ubuntu-dev-tools (0.56) UNRELEASED; urgency=low
folder world unreadable. folder world unreadable.
* common.py: Improved no credentials found error message to show which * common.py: Improved no credentials found error message to show which
consumer token is needed. consumer token is needed.
* requestsync: Catch credentials error to hide traceback.
-- Jonathan Davies <jpds@ubuntu.com> Thu, 15 Jan 2009 12:35:12 +0000 -- Jonathan Davies <jpds@ubuntu.com> Thu, 15 Jan 2009 12:35:12 +0000

View File

@ -104,6 +104,10 @@ def checkExistingReports(package):
"manually check at:" "manually check at:"
print "- https://bugs.launchpad.net/ubuntu/+source/%s" % package print "- https://bugs.launchpad.net/ubuntu/+source/%s" % package
return False return False
except IOError, msg:
# No credentials found.
print msg
sys.exit(1)
# Fetch the package's bug list from Launchpad. # Fetch the package's bug list from Launchpad.
pkg = launchpad.distributions["ubuntu"].getSourcePackage(name=package) pkg = launchpad.distributions["ubuntu"].getSourcePackage(name=package)
@ -343,6 +347,10 @@ def post_bug(source_package, subscribe, status, bugtitle, bugtext):
except ImportError: except ImportError:
print >> sys.stderr, 'Importing launchpadlib failed. Is python-launchpadlib installed?' print >> sys.stderr, 'Importing launchpadlib failed. Is python-launchpadlib installed?'
return False return False
except IOError, msg:
# No credentials found.
print msg
sys.exit(1)
if source_package: if source_package:
product_url = "%subuntu/+source/%s" %(launchpad._root_uri, source_package) product_url = "%subuntu/+source/%s" %(launchpad._root_uri, source_package)