Skip to content

Commit

Permalink
remove b4 encoding for userTags. DON'T PR until labs are updated.
Browse files Browse the repository at this point in the history
  • Loading branch information
kreynoldsf5 committed Apr 26, 2024
1 parent 4d0c1f4 commit 51d3a83
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
9 changes: 4 additions & 5 deletions base/app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,23 +52,22 @@ def find_aws_cred(cloud_accounts: dict) -> dict|None:
except Exception as e:
return None

def find_user_tags(meta_tags: list) -> dict|None:
def find_user_tags(meta_tags: list, tags: list) -> dict|None:
"""
Find user_tags from instance metadata.
Return a dict with all b64 decoded tags.
"""
try:
all_tags = meta_tags[0].get("userTags", [])
tags = ["LabID", "SQS_r", "SQS_q"]
user_tags = {}
tag_list = [t for t in all_tags if t.get("name") in tags]
for tag in tag_list:
user_tags[tag["name"]] = b64_lazy_decode(tag["value"])
user_tags[tag["name"]] = tag["value"]
except Exception as e:
return None
if len(user_tags) == 3:
if len(user_tags) == len(tags):
return user_tags
else:
print(f"Unable to find User Tags.")
return None

def build_sqs_url(region: str, q: str) -> str|None:
Expand Down
1 change: 0 additions & 1 deletion site/app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ def find_aws_cred(cloud_accounts: dict) -> dict|None:
def find_user_tags(meta_tags: list, tags: list) -> dict|None:
"""
Find user_tags from instance metadata.
Return a dict with all b64 decoded tags needed for this service.
"""
print("DEBUG")
print(f"meta_tags: {meta_tags}")
Expand Down

0 comments on commit 51d3a83

Please sign in to comment.