Tim Andersson has proposed merging ~andersson123/autopkgtest-cloud:service-message 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/464028 -- Your team Canonical's Ubuntu QA is requested to review the proposed merge of ~andersson123/autopkgtest-cloud:service-message into autopkgtest-cloud:master.
diff --git a/charms/focal/autopkgtest-web/config.yaml b/charms/focal/autopkgtest-web/config.yaml index a60637a..09f71ae 100644 --- a/charms/focal/autopkgtest-web/config.yaml +++ b/charms/focal/autopkgtest-web/config.yaml @@ -57,3 +57,8 @@ options: type: string default: ~ description: "List of teams that are allowed to request autopkgtest tests." + important-service-message: + type: string + default: "" + description: "Short, one-sentence message regarding \ + autopkgtest.ubuntu.com's most important service update." diff --git a/charms/focal/autopkgtest-web/reactive/autopkgtest_web.py b/charms/focal/autopkgtest-web/reactive/autopkgtest_web.py index 4386e50..37e22df 100644 --- a/charms/focal/autopkgtest-web/reactive/autopkgtest_web.py +++ b/charms/focal/autopkgtest-web/reactive/autopkgtest_web.py @@ -31,6 +31,7 @@ CONFIG_DIR = pathlib.Path("/home/ubuntu/.config/autopkgtest-web/") for parent in reversed(CONFIG_DIR.parents): parent.mkdir(mode=0o770, exist_ok=True) ALLOWED_REQUESTOR_TEAMS_PATH = CONFIG_DIR / "allowed-requestor-teams" +SERVICE_MESSAGE_PATH = CONFIG_DIR / "important-service-message" PUBLIC_SWIFT_CREDS_PATH = os.path.expanduser("~ubuntu/public-swift-creds") @@ -166,6 +167,15 @@ def initially_configure_website(website): @when_any( + "config.changed.important-service-message", + "config.set.important-service-message", +) +def write_service_message(): + service_message = config().get("important-service-message") + SERVICE_MESSAGE_PATH.write_text(service_message) + + +@when_any( "config.changed.hostname", "config.changed.https-proxy", "config.changed.no-proxy", diff --git a/charms/focal/autopkgtest-web/webcontrol/browse.cgi b/charms/focal/autopkgtest-web/webcontrol/browse.cgi index 309fb82..a6e8c0a 100755 --- a/charms/focal/autopkgtest-web/webcontrol/browse.cgi +++ b/charms/focal/autopkgtest-web/webcontrol/browse.cgi @@ -4,6 +4,7 @@ import json import os +import pathlib import re import sqlite3 from collections import OrderedDict @@ -31,6 +32,12 @@ app.config["SEND_FILE_MAX_AGE_DEFAULT"] = 60 app.wsgi_app = ProxyFix(app.wsgi_app, x_proto=1) +SERVICE_MESSAGE_PATH = pathlib.Path( + "/home/ubuntu/.config/autopkgtest-web/important-service-message" +) +if SERVICE_MESSAGE_PATH.is_file(): + app.config["important-service-message"] = SERVICE_MESSAGE_PATH.read_text() + secret_path = os.path.join(PATH, "secret_key") setup_key(app, secret_path) diff --git a/charms/focal/autopkgtest-web/webcontrol/static/style.css b/charms/focal/autopkgtest-web/webcontrol/static/style.css index eb8fc11..1ee18a2 100644 --- a/charms/focal/autopkgtest-web/webcontrol/static/style.css +++ b/charms/focal/autopkgtest-web/webcontrol/static/style.css @@ -129,3 +129,10 @@ th.sticky-table-headers { .unfinished { color: grey; } + +.service { + margin-left: 350px; + width: 54%; + background: yellow; + text-align: center; +} diff --git a/charms/focal/autopkgtest-web/webcontrol/templates/browse-layout.html b/charms/focal/autopkgtest-web/webcontrol/templates/browse-layout.html index e4cfce6..82f9be5 100644 --- a/charms/focal/autopkgtest-web/webcontrol/templates/browse-layout.html +++ b/charms/focal/autopkgtest-web/webcontrol/templates/browse-layout.html @@ -42,6 +42,11 @@ </div> </div> + {% if config.get("important-service-message") %} + <div class="service"> + <p>PSA: {{ config.get("important-service-message") }}</p> + </div> + {% endif %} <div class="container"> {% block content %}{% endblock %}
-- Mailing list: https://launchpad.net/~canonical-ubuntu-qa Post to : canonical-ubuntu-qa@lists.launchpad.net Unsubscribe : https://launchpad.net/~canonical-ubuntu-qa More help : https://help.launchpad.net/ListHelp