From 992196eca0bd0739c23de7f6ea764e74e838b14b Mon Sep 17 00:00:00 2001 From: Thomas E Lackey Date: Mon, 4 Dec 2023 10:47:25 -0600 Subject: [PATCH] fmt --- .../data/scripts/auto-deploy-webapp.py | 23 +++++++++++++------ .../data/scripts/requirements.txt | 1 + 2 files changed, 17 insertions(+), 7 deletions(-) create mode 100644 stack_orchestrator/data/scripts/requirements.txt diff --git a/stack_orchestrator/data/scripts/auto-deploy-webapp.py b/stack_orchestrator/data/scripts/auto-deploy-webapp.py index f7629ead..455316a5 100644 --- a/stack_orchestrator/data/scripts/auto-deploy-webapp.py +++ b/stack_orchestrator/data/scripts/auto-deploy-webapp.py @@ -79,8 +79,17 @@ def redeploy(app_record, deploy_record, deploy_crn, deployment_dir): version = "0.0.%d" % (int(deploy_record["attributes"]["version"].split(".")[-1]) + 1) meta = { - "record": {"type": "WebAppDeploymentRecord", "version": version, "url": f"http://{hostname}", "name": hostname, - "application": app_record["id"], "meta": {"config": config_hash(deployment_dir)}, }} + "record": { + "type": "WebAppDeploymentRecord", + "version": version, + "url": f"http://{hostname}", + "name": hostname, + "application": app_record["id"], + "meta": { + "config": config_hash(deployment_dir) + }, + } + } tmpdir = tempfile.mkdtemp() try: @@ -91,9 +100,9 @@ def redeploy(app_record, deploy_record, deploy_crn, deployment_dir): print(open(record_fname, 'r').read()) print("Updating deployment record ...") - new_record_id = \ - json.loads(cmd("laconic", "-c", args.laconic_config, "cns", "record", "publish", "--filename", record_fname))[ - "id"] + new_record_id = json.loads( + cmd("laconic", "-c", args.laconic_config, "cns", "record", "publish", "--filename", record_fname) + )["id"] print("Updating deployment registered name ...") cmd("laconic", "-c", args.laconic_config, "cns", "name", "set", deploy_crn, new_record_id) finally: @@ -119,7 +128,7 @@ app_record = json.loads(cmd("laconic", "-c", args.laconic_config, "cns", "name", # compare try: deploy_record = json.loads(cmd("laconic", "-c", args.laconic_config, "cns", "name", "resolve", args.deploy_crn))[0] -except: +except: # noqa: E722 deploy_record = {} needs_update = False @@ -128,7 +137,7 @@ if app_record["id"] == deploy_record.get("attributes", {}).get("application"): print("Deployment %s already has latest application: %s" % (args.deploy_crn, app_record["id"])) else: print("Found updated application record eligible for deployment %s (old: %s, new: %s)" % ( - args.deploy_crn, deploy_record.get("id"), app_record["id"])) + args.deploy_crn, deploy_record.get("id"), app_record["id"])) build_image(app_record, args.deployment_dir) needs_update = True diff --git a/stack_orchestrator/data/scripts/requirements.txt b/stack_orchestrator/data/scripts/requirements.txt new file mode 100644 index 00000000..11b65037 --- /dev/null +++ b/stack_orchestrator/data/scripts/requirements.txt @@ -0,0 +1 @@ +PyYAML>=6.0.1