← Back to team overview

canonical-ubuntu-qa team mailing list archive

[Merge] ~andersson123/autopkgtest-cloud:allowed-teams-to-juju-config into autopkgtest-cloud:master

 

Tim Andersson has proposed merging ~andersson123/autopkgtest-cloud:allowed-teams-to-juju-config 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/461359
-- 
Your team Canonical's Ubuntu QA is requested to review the proposed merge of ~andersson123/autopkgtest-cloud:allowed-teams-to-juju-config into autopkgtest-cloud:master.
diff --git a/charms/focal/autopkgtest-web/reactive/autopkgtest_web.py b/charms/focal/autopkgtest-web/reactive/autopkgtest_web.py
index 6920fc1..1001ceb 100644
--- a/charms/focal/autopkgtest-web/reactive/autopkgtest_web.py
+++ b/charms/focal/autopkgtest-web/reactive/autopkgtest_web.py
@@ -24,6 +24,7 @@ GITHUB_STATUS_CREDENTIALS_PATH = os.path.expanduser(
 SWIFT_WEB_CREDENTIALS_PATH = os.path.expanduser(
     "~ubuntu/swift-web-credentials.conf"
 )
+ALLOWED_TEAMS_PATH = "/home/ubuntu/allowed-teams"
 
 PUBLIC_SWIFT_CREDS_PATH = os.path.expanduser("~ubuntu/public-swift-creds")
 
@@ -236,6 +237,14 @@ def set_up_web_config(apache):
     apache.send_enabled()
 
 
+@when_all("config.changed.allowed-teams", "config.set.allowed-teams")
+def write_allowed_teams():
+    allowed_teams = config().get("allowed-teams")
+
+    with open(ALLOWED_TEAMS_PATH, "w") as f:
+        f.write(allowed_teams)
+
+
 @when_all("config.changed.github-secrets", "config.set.github-secrets")
 def write_github_secrets():
     github_secrets = config().get("github-secrets")
diff --git a/charms/focal/autopkgtest-web/webcontrol/request/submit.py b/charms/focal/autopkgtest-web/webcontrol/request/submit.py
index 0133d44..b993606 100644
--- a/charms/focal/autopkgtest-web/webcontrol/request/submit.py
+++ b/charms/focal/autopkgtest-web/webcontrol/request/submit.py
@@ -36,15 +36,11 @@ ENV = re.compile(r"^[a-zA-Z][a-zA-Z0-9_]+=[a-zA-Z0-9.:~/ -=]*$")
 # URL and optional branch name
 GIT = re.compile(r"^https?://[a-zA-Z0-9._/~+-]+(#[a-zA-Z0-9._/-]+)?$")
 
-ALLOWED_TEAMS = [
-    "canonical-kernel-distro-team",
-    "autopkgtest-requestors",
-    "canonical-partner-eng",
-    "canonical-server",
-    "canonical-foundations",
-    "canonical-security",
-    "canonical-ubuntu-qa",
-]
+# move me
+ALLOWED_TEAMS = []
+with open("/home/ubuntu/allowed-teams", "r") as f:
+    ALLOWED_TEAMS = f.read().splitlines()
+
 # not teams
 ALLOWED_USERS_PERPACKAGE = {"snapcraft": ["snappy-m-o"]}
 
diff --git a/mojo/service-bundle b/mojo/service-bundle
index e6b6a1f..c64b06a 100644
--- a/mojo/service-bundle
+++ b/mojo/service-bundle
@@ -183,6 +183,14 @@ applications:
         channel: {{ channel }}
         options:
             hostname: {{ hostname }}
+            allowed-teams:
+                - canonica-kernel-distro-team
+                - autopkgtest-requestors
+                - canonical-partner-eng
+                - canonical-server
+                - canonical-foundations
+                - canonical-security
+                - canonical-ubuntu-qa
 {%- if stage_name == "production" %}
             {%- set storage_host_internal = "objectstorage.prodstack5.canonical.com:443" %}
             {%- set storage_path_internal = "/swift/v1/AUTH_0f9aae918d5b4744bf7b827671c86842" %}

Follow ups