outposts: fix error when getting state for non-existent outpost

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer
2021-12-20 19:44:08 +01:00
parent 68637cf7cf
commit 80d0b14bb8
2 changed files with 3 additions and 0 deletions

View File

@ -481,6 +481,8 @@ class OutpostState:
def for_outpost(outpost: Outpost) -> list["OutpostState"]:
"""Get all states for an outpost"""
keys = cache.keys(f"{outpost.state_cache_prefix}_*")
if not keys:
return []
states = []
for key in keys:
instance_uid = key.replace(f"{outpost.state_cache_prefix}_", "")