← Back to team overview

canonical-ubuntu-qa team mailing list archive

[Merge] ~andersson123/autopkgtest-cloud:fix_github_dupe_requests into autopkgtest-cloud:master

 

Tim Andersson has proposed merging ~andersson123/autopkgtest-cloud:fix_github_dupe_requests into autopkgtest-cloud:master.

Requested reviews:
  Canonical's Ubuntu QA (canonical-ubuntu-qa)

For more details, see:
https://code.launchpad.net/~andersson123/autopkgtest-cloud/+git/autopkgtest-cloud/+merge/448877

Fixes the error reported in IRC:
16:37 < bluca> bdmurray: the webhooks to trigger 
               systemd autopkgtest are failing with 
               "HTTP Error 500: Internal Server 
               Error", known issue?

The whole time the code was doing the correct thing - rejecting duplicate requests, but because it wasn't getting caught properly, it was being reported to the user as a 500 internal server error. I've hotfixed it in prod
-- 
Your team Canonical's Ubuntu QA is requested to review the proposed merge of ~andersson123/autopkgtest-cloud:fix_github_dupe_requests into autopkgtest-cloud:master.
diff --git a/charms/focal/autopkgtest-web/webcontrol/request/app.py b/charms/focal/autopkgtest-web/webcontrol/request/app.py
index 8ad5270..758f05e 100644
--- a/charms/focal/autopkgtest-web/webcontrol/request/app.py
+++ b/charms/focal/autopkgtest-web/webcontrol/request/app.py
@@ -188,6 +188,8 @@ def index_root():
             return invalid(e)
         except KeyError as e:
             return invalid("Missing field in JSON data: %s" % e)
+        except DuplicateRequestException as e:
+            return invalid(e, 403)
 
         s.send_amqp_request(context="upstream", **params)
         # write status file for pending test

Follow ups