From 27f5c9fc21e18dc9af5a33145b86dba1d62d04f8 Mon Sep 17 00:00:00 2001 From: Thomas E Lackey Date: Wed, 14 Aug 2024 12:38:17 -0500 Subject: [PATCH] Handle errors which checking for a missing app. --- .../deploy/webapp/deploy_webapp_from_registry.py | 10 ++++++++-- stack_orchestrator/deploy/webapp/util.py | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/stack_orchestrator/deploy/webapp/deploy_webapp_from_registry.py b/stack_orchestrator/deploy/webapp/deploy_webapp_from_registry.py index 9031e798..f27b62ee 100644 --- a/stack_orchestrator/deploy/webapp/deploy_webapp_from_registry.py +++ b/stack_orchestrator/deploy/webapp/deploy_webapp_from_registry.py @@ -278,9 +278,15 @@ def command(ctx, kube_config, laconic_config, image_registry, deployment_parent_ print(f"Skipping request {r.id}, we've already seen it.") continue - app = laconic.get_record(r.attributes.application) + try: + app = laconic.get_record(r.attributes.application) + except Exception as e: + print("ERROR: " + str(e)) + app = None + if not app: - print("Skipping request %s, cannot locate app." % r.id) + print(f"Skipping request {r.id}, cannot locate app.") + dump_known_requests(state_file, [r]) continue requested_name = r.attributes.dns diff --git a/stack_orchestrator/deploy/webapp/util.py b/stack_orchestrator/deploy/webapp/util.py index cc476656..5061566e 100644 --- a/stack_orchestrator/deploy/webapp/util.py +++ b/stack_orchestrator/deploy/webapp/util.py @@ -172,7 +172,7 @@ class LaconicRegistryClient: name_or_id, ] - parsed = [AttrDict(r) for r in json.loads(logged_cmd(self.log_file, *args))] + parsed = [AttrDict(r) for r in json.loads(logged_cmd(self.log_file, *args)) if r] if len(parsed): self._add_to_cache(parsed) return parsed[0]