Skip to content

Commit

Permalink
fixed sqs URL function
Browse files Browse the repository at this point in the history
  • Loading branch information
kreynoldsf5 committed Apr 12, 2024
1 parent cce938f commit 9f2bc1c
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions base/app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import json
import re
import atexit
import base64
import base64
import requests
import boto3

Expand Down Expand Up @@ -76,7 +76,7 @@ def build_sqs_url(region: str, q: str) -> str|None:
Build a complete SQS queue URL from the pieces in user_tags
"""
try:
url = f"https://sqs/{region}.amazonaws.com/{q}"
url = f"https://sqs.{region}.amazonaws.com/{q}"
return url
except Exception as e:
return None
Expand All @@ -100,29 +100,24 @@ def query_metadata(metadata_base_url: str) -> dict|None:
deployment_url = f"{metadata_base_url}/deployment"
user_tags_url = f"{metadata_base_url}/userTags/name/XC/value/true"
cloud_accounts_url = f"{metadata_base_url}/cloudAccounts"

deployment = fetch_metadata(deployment_url)
if deployment is None:
print("Unable to find deployment data.")
return None

user_tags = find_user_tags(fetch_metadata(user_tags_url))
if user_tags is None:
print("Unable to find user tags.")
return None

aws_credential = find_aws_cred(fetch_metadata(cloud_accounts_url))
if aws_credential is None:
print("Unable to find AWS metadata.")
return None

try:
dep_id = deployment.get("deployment")["id"]
deployer = deployment.get("deployment")["deployer"]
lab_id = user_tags.get("LabID")
sqs_url = build_sqs_url(user_tags.get("SQS_r"), user_tags.get("SQS_q"))
region = find_sqs_region(sqs_url)

return {
"depID": dep_id,
"deployer": deployer,
Expand Down

0 comments on commit 9f2bc1c

Please sign in to comment.