From 1973bde3e075763320f0188d1d8d3a8059a82e18 Mon Sep 17 00:00:00 2001 From: Iain Lane Date: Sat, 7 Nov 2009 19:34:59 +0000 Subject: [PATCH] Also modify grab-attachments, hugdaylist, update-maintainer to bail on no creds --- debian/changelog | 7 ++++--- grab-attachments | 39 +++++++++++++++++++++++---------------- hugdaylist | 8 +++++++- update-maintainer | 6 ++++++ 4 files changed, 40 insertions(+), 20 deletions(-) diff --git a/debian/changelog b/debian/changelog index 8ddf450..c681452 100644 --- a/debian/changelog +++ b/debian/changelog @@ -7,10 +7,11 @@ ubuntu-dev-tools (0.83) UNRELEASED; urgency=low default release if we aren't using it. (LP: #477670) * pull-lp-source: Detect more failure conditions and give a nice error instead of a trace - * buildd, requestsync: Detect & bail if we don't have credentials and need - them. These scripts cannot continue under those circumstances. + * buildd, requestsync, grab-attachments, hugdaylist, update-maintainer: + Detect & bail if we don't have credentials and need them. These scripts + cannot continue under those circumstances. - -- Iain Lane Sat, 07 Nov 2009 19:18:27 +0000 + -- Iain Lane Sat, 07 Nov 2009 19:34:25 +0000 ubuntu-dev-tools (0.82) lucid; urgency=low diff --git a/grab-attachments b/grab-attachments index 9c99056..3062526 100755 --- a/grab-attachments +++ b/grab-attachments @@ -33,23 +33,30 @@ def main(): print USAGE sys.exit(0) - launchpad = get_launchpad("ubuntu-dev-tools") - for arg in sys.argv[1:]: - try: - number = int(arg) - except: - print >> sys.stderr, "'%s' is not a valid bug number." % arg - sys.exit(1) + try: + launchpad = get_launchpad("ubuntu-dev-tools") - b = launchpad.bugs[number] - - for a in b.attachments: - f = a.data.open() - filename = os.path.join(os.getcwd(), f.filename) - local_file = open(filename, "w") - local_file.write(f.read()) - f.close() - local_file.close() + for arg in sys.argv[1:]: + try: + number = int(arg) + except: + print >> sys.stderr, "'%s' is not a valid bug number." % arg + sys.exit(1) + + b = launchpad.bugs[number] + + for a in b.attachments: + f = a.data.open() + filename = os.path.join(os.getcwd(), f.filename) + local_file = open(filename, "w") + local_file.write(f.read()) + f.close() + local_file.close() + + # no LP credentials + except IOError, e: + print e + sys.exit(1) if __name__ == '__main__': main() diff --git a/hugdaylist b/hugdaylist index e112292..431515c 100755 --- a/hugdaylist +++ b/hugdaylist @@ -88,7 +88,13 @@ def main(): print >> sys.stderr, "Options in url are not supported, url: %s" %url sys.exit(1) - launchpad = get_launchpad("ubuntu-dev-tools") + launchpad = None + try: + launchpad = get_launchpad("ubuntu-dev-tools") + except IOError, e: + print e + sys.exit(1) + api_url = translate_web_api(url, launchpad) try: product = launchpad.load(api_url) diff --git a/update-maintainer b/update-maintainer index 1d3e822..eff9482 100755 --- a/update-maintainer +++ b/update-maintainer @@ -31,6 +31,12 @@ import re import sys import ubuntutools.packages +# Cannot work without LP credentials +try: + Launchpad.login() +except IOError: + sys.exit(1) + valid_locations = ["debian/control.in", "control.in", "debian/control", "control"] control_file_found = False