← Back to team overview

canonical-ubuntu-qa team mailing list archive

[Merge] ~andersson123/autopkgtest-cloud:web-fix-config-dir-permissions into autopkgtest-cloud:master

 

Tim Andersson has proposed merging ~andersson123/autopkgtest-cloud:web-fix-config-dir-permissions 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/463833
-- 
Your team Canonical's Ubuntu QA is requested to review the proposed merge of ~andersson123/autopkgtest-cloud:web-fix-config-dir-permissions 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 d195127..a228a0f 100644
--- a/charms/focal/autopkgtest-web/reactive/autopkgtest_web.py
+++ b/charms/focal/autopkgtest-web/reactive/autopkgtest_web.py
@@ -28,7 +28,8 @@ SWIFT_WEB_CREDENTIALS_PATH = os.path.expanduser(
 )
 API_KEYS_PATH = "/home/ubuntu/external-web-requests-api-keys.json"
 CONFIG_DIR = pathlib.Path("/home/ubuntu/.config/autopkgtest-web/")
-CONFIG_DIR.mkdir(exist_ok=True, parents=True)
+for parent in reversed(CONFIG_DIR.parents):
+    parent.mkdir(mode=0o770, exist_ok=True)
 ALLOWED_REQUESTOR_TEAMS_PATH = CONFIG_DIR / "allowed-requestor-teams"
 
 PUBLIC_SWIFT_CREDS_PATH = os.path.expanduser("~ubuntu/public-swift-creds")
diff --git a/charms/focal/autopkgtest-web/webcontrol/request/submit.py b/charms/focal/autopkgtest-web/webcontrol/request/submit.py
index 5848e64..d0b572d 100644
--- a/charms/focal/autopkgtest-web/webcontrol/request/submit.py
+++ b/charms/focal/autopkgtest-web/webcontrol/request/submit.py
@@ -42,9 +42,8 @@ try:
     allowed_teams = pathlib.Path(
         "/home/ubuntu/.config/autopkgtest-web/allowed-requestor-teams"
     )
-    ALLOWED_REQUESTOR_TEAMS = allowed_teams.read_text(
-        encoding="utf-8"
-    ).splitlines()
+    for team in allowed_teams.read_text(encoding="utf-8").splitlines():
+        ALLOWED_REQUESTOR_TEAMS.append(team.rstrip())
 except Exception as e:
     logging.warning(f"Reading allowed teams failed with {e}")