diff options
author | Michael Palimaka <kensington@gentoo.org> | 2016-12-22 17:46:22 +1100 |
---|---|---|
committer | Michael Palimaka <kensington@gentoo.org> | 2016-12-22 17:46:46 +1100 |
commit | 3b3281de80ef09b7abfff3dd13141e776ea89a43 (patch) | |
tree | 511c6d167a836d78b8a92ee41f7a5f2112701586 | |
parent | Fix runaway formatting in tatt.5 (diff) | |
download | tatt-3b3281de80ef09b7abfff3dd13141e776ea89a43.tar.gz tatt-3b3281de80ef09b7abfff3dd13141e776ea89a43.tar.bz2 tatt-3b3281de80ef09b7abfff3dd13141e776ea89a43.zip |
Print the returned error message if the Bugzilla request fails.
-rwxr-xr-x | scripts/tatt | 6 | ||||
-rw-r--r-- | templates/updatebug | 9 |
2 files changed, 13 insertions, 2 deletions
diff --git a/scripts/tatt b/scripts/tatt index 205adcb..c9fdbee 100755 --- a/scripts/tatt +++ b/scripts/tatt @@ -134,7 +134,11 @@ if options.bugnum: print("Bugnumber: " + options.bugnum) myJob.bugnumber=options.bugnum params = {"id": options.bugnum} - response = session.get(config["bugzilla-url"] + "/rest/bug", params=params).json()["bugs"][0] + response = session.get(config["bugzilla-url"] + "/rest/bug", params=params).json() + if "message" in response: + print(response["message"]) + sys.exit(1) + response = response["bugs"][0] if "KEYWORDREQ" in response["keywords"] or response["component"] == "Keywording": # This is a keywording bug: print ("Keywording bug detected.") diff --git a/templates/updatebug b/templates/updatebug index 25b18a8..e11d927 100644 --- a/templates/updatebug +++ b/templates/updatebug @@ -4,6 +4,7 @@ import portage.versions import requests +import sys from tatt.tattConfig import tattConfig as tattConfig @@ -16,7 +17,13 @@ def main(): bug_id = str(@@BUG@@) params = {'id': bug_id} - response = session.get(tattconfig['bugzilla-url'] + '/rest/bug', params=params).json()['bugs'][0] + response = session.get(tattconfig['bugzilla-url'] + '/rest/bug', params=params).json() + + if 'message' in response: + print(response['message']) + sys.exit(1) + + response = response['bugs'][0] has_my_arch = False has_other_arches = False |