From 51d3a83c2dad1e69b0a650e027a98acadca41a26 Mon Sep 17 00:00:00 2001 From: Kevin Reynolds Date: Fri, 26 Apr 2024 11:59:22 -0400 Subject: [PATCH] remove b4 encoding for userTags. DON'T PR until labs are updated. --- base/app/app.py | 9 ++++----- site/app/app.py | 1 - 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/base/app/app.py b/base/app/app.py index 37d8431..5e397c2 100644 --- a/base/app/app.py +++ b/base/app/app.py @@ -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: diff --git a/site/app/app.py b/site/app/app.py index 6814c50..fdaf2dc 100644 --- a/site/app/app.py +++ b/site/app/app.py @@ -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}")