mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Check the existence of the file before trying to read from it
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
This commit is contained in:
parent
c2a15672ba
commit
aa34a59dad
1 changed files with 4 additions and 2 deletions
|
@ -591,8 +591,10 @@ def sync_cache(
|
|||
cached_instances = {}
|
||||
if STATE_DIR.exists():
|
||||
for state_path in STATE_DIR.iterdir():
|
||||
instance_id = (state_path / "instance-id").read_text()
|
||||
cached_instances[instance_id] = state_path.name
|
||||
instance_id_path = state_path / "instance-id"
|
||||
if instance_id_path.exists():
|
||||
instance_id = instance_id_path.read_text()
|
||||
cached_instances[instance_id] = state_path.name
|
||||
|
||||
# Find what instances we are missing in our cached states
|
||||
to_write = {}
|
||||
|
|
Loading…
Add table
Reference in a new issue