From 6c4b5f4a530dc15b611df91d4613039077d928fd Mon Sep 17 00:00:00 2001 From: Vallari Agrawal Date: Wed, 21 Aug 2024 23:39:11 +0530 Subject: [PATCH] services/helpers.py: handle empty GH_ORG_TEAM_URL and ADMIN_TEAM Signed-off-by: Vallari Agrawal --- src/teuthology_api/services/helpers.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/teuthology_api/services/helpers.py b/src/teuthology_api/services/helpers.py index a7e1d6e..c4bcd33 100644 --- a/src/teuthology_api/services/helpers.py +++ b/src/teuthology_api/services/helpers.py @@ -104,6 +104,9 @@ def get_token(request: Request): async def isAdmin(username, token): + if not (GH_ORG_TEAM_URL and ADMIN_TEAM): + log.error("GH_ORG_TEAM_URL or ADMIN_TEAM is not set in .env") + return False TEAM_MEMBER_URL = f"{GH_ORG_TEAM_URL}/{ADMIN_TEAM}/memberships/{username}" async with httpx.AsyncClient() as client: headers = {