← Back to team overview

canonical-ubuntu-qa team mailing list archive

[Merge] ~hyask/autopkgtest-cloud:skia/fix_hardcoded_url into autopkgtest-cloud:master

 

Skia has proposed merging ~hyask/autopkgtest-cloud:skia/fix_hardcoded_url into autopkgtest-cloud:master.

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

For more details, see:
https://code.launchpad.net/~hyask/autopkgtest-cloud/+git/autopkgtest-cloud/+merge/457816
-- 
Your team Canonical's Ubuntu QA is requested to review the proposed merge of ~hyask/autopkgtest-cloud:skia/fix_hardcoded_url 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 9f05437..65c891c 100644
--- a/charms/focal/autopkgtest-web/webcontrol/request/app.py
+++ b/charms/focal/autopkgtest-web/webcontrol/request/app.py
@@ -6,7 +6,7 @@ import os
 from collections import ChainMap
 from html import escape as _escape
 
-from flask import Flask, redirect, request, session
+from flask import Flask, redirect, request, session, url_for
 from flask_openid import OpenID
 from helpers.exceptions import WebControlException
 from helpers.utils import setup_key
@@ -217,7 +217,8 @@ def index_root():
             "state": "pending",
             "context": "%s-%s" % (params["release"], params["arch"]),
             "description": "autopkgtest running",
-            "target_url": "http://autopkgtest.ubuntu.com/running#pkg-";
+            "target_url": url_for("index_root")
+            + "running#pkg-"
             + params["package"],
         }
         s.post_json(
@@ -259,8 +260,11 @@ def index_root():
             s.send_amqp_request(**params)
         # add link to result page for Ubuntu results
         if not params.get("ppas"):
-            url = "https://autopkgtest.ubuntu.com/packages/{}/{}/{}".format(
-                params["package"], params["release"], params["arch"]
+            url = "{}packages/{}/{}/{}".format(
+                url_for("index_root"),
+                params["package"],
+                params["release"],
+                params["arch"],
             )
             params["Result history"] = '<a href="{}">{}</a>'.format(url, url)
         success = SUCCESS.format(

References