Skip to content

Commit

Permalink
Merge pull request #117 from uc-cdis/feat/VADC-783
Browse files Browse the repository at this point in the history
VADC-783
  • Loading branch information
tianj7 authored Nov 14, 2023
2 parents d12559a + 7716519 commit 95d0a91
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/argowrapper/routes/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,21 +151,25 @@ def check_user_billing_id(request):
remove gen3 username from pod metadata
"""

header = {"Authorization", request.headers.get("Authorization")}
url = request.base_url._url.rstrip("/") + "/user/user"
header = {"Authorization": request.headers.get("Authorization")}
url = "http://fence-service/user"
try:
r = requests.get(url=url, headers=header)
r.raise_for_status()
user_info = r.json()
except Exception as e:
exception = Exception("Could not determine user billing info from fence", e)
logger.error(exception)
traceback.print_exc()
raise exception
logger.info("Got user info successfully. Checking for billing id..")

if "tags" in user_info and "billing_id" in user_info["tags"]:
billing_id = user_info["tags"]["billing_id"]
logger.info("billing id found in user tags: " + billing_id)
return billing_id
else:
logger.info("billing id not found.")
return None


Expand Down

0 comments on commit 95d0a91

Please sign in to comment.