Handle errors which checking for a missing app.

This commit is contained in:
Thomas E Lackey 2024-08-14 12:38:17 -05:00
parent 8576137557
commit 27f5c9fc21
2 changed files with 9 additions and 3 deletions

View File

@ -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

View File

@ -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]