diff --git a/base/app/app.py b/base/app/app.py index a3fa384..4bf09ad 100644 --- a/base/app/app.py +++ b/base/app/app.py @@ -13,18 +13,20 @@ import petname from flask import Flask, jsonify +state_base = "/var/lib/private/orijen-udf-base/" + def run_flask(app): """Function to run the Flask app on a separate thread.""" app.run(host='0.0.0.0', port=5123) def save_state(file, state): - os.makedirs(os.path.dirname(file), exist_ok=True) - with open(file, 'w') as f: + os.makedirs(os.path.dirname(state_base + file), exist_ok=True) + with open(state_base+ file, 'w') as f: json.dump(state, f) def load_state(file): try: - with open(file, 'r') as f: + with open(state_base + file, 'r') as f: return json.load(f) except FileNotFoundError: return {} @@ -226,14 +228,12 @@ def send_sqs(meta: dict, kill: bool=False) -> dict|None: def main(): """ Main Function - """ - state_base = "/var/lib/private/orijen-udf-base/" - + """ metadata = query_metadata() labInfo = get_lab_info(metadata) sqsMeta = build_sqs_meta(metadata, labInfo) - petName = load_state(state_base + "petname.json") + petName = load_state("petname.json") if not petName: petName = generate_petname()