Defensively handle errors examining app requests. #922

Merged
telackey merged 2 commits from telackey/missing_app into main 2024-08-14 18:04:32 +00:00
2 changed files with 9 additions and 3 deletions
Showing only changes of commit 27f5c9fc21 - Show all commits

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]