Skip to content

Commit

Permalink
added group folder to telemetry.json webservice
Browse files Browse the repository at this point in the history
fixed error

updated version number
  • Loading branch information
tsebastiani committed Feb 28, 2024
1 parent a1f6499 commit 2c19f52
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
13 changes: 7 additions & 6 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

app = Flask(__name__)

telemetry_category: str = "telemetry_category"
request_id_param: str = "request_id"
telemetry_group_param: str = "telemetry_group"
remote_filename_param: str = "remote_filename"


Expand All @@ -28,10 +28,13 @@ def telemetry():
query_params = request.args
if request_id_param not in query_params.keys():
return Response("[bad request]: missing request_id param", status=400)
category_folder = query_params.get(telemetry_category)
if telemetry_group_param not in query_params.keys():
return Response(
"[bad request]: missing telemetry_group param", status=400
)
folder_name = query_params.get(request_id_param)
if category_folder:
folder_name = f"{category_folder}/{folder_name}"
folder_name = f"{query_params.get(telemetry_group_param)}/{folder_name}"

bucket_name = os.getenv("BUCKET_NAME")
if bucket_name is None:
return Response("BUCKET_NAME env variable not set", status=500)
Expand Down Expand Up @@ -70,8 +73,6 @@ def presigned_post():
)

request_id = query_params[request_id_param]
if telemetry_category in query_params.keys():
request_id = f"{query_params[telemetry_category]}/{request_id}"

remote_filename = query_params[remote_filename_param]
s_three = boto3.client("s3")
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ flask = "^2.3.2"
zappa = "^0.57.0"
boto3 = "^1.26.148"
#krkn-lib = "^1.4.5"
krkn-lib = { git = "https://github.com/krkn-chaos/krkn-lib.git", branch = "telemetry_ws_rework" }
krkn-lib = "^2.0.0"

[build-system]
requires = ["poetry-core"]
Expand Down

0 comments on commit 2c19f52

Please sign in to comment.