Skip to content

Commit

Permalink
[saltmaster] handle undefined pillar_roots
Browse files Browse the repository at this point in the history
AttributeError: 'NoneType' object has no attribute 'get'
Resolves: #3819

Signed-off-by: Trevor Benson <[email protected]>
  • Loading branch information
TrevorBenson authored and TurboTurtle committed Oct 24, 2024
1 parent 98631ec commit 40ece39
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions sos/report/plugins/saltmaster.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,13 @@ def add_pillar_roots(self):
all_pillar_roots = []
for cfg in cfgs:
with open(cfg, "r", encoding='UTF-8') as file:
cfg_pillar_roots = (
yaml.safe_load(file).get("pillar_roots", {}).
get("base", [])
)
try:
cfg_pillar_roots = (
yaml.safe_load(file).get("pillar_roots", {}).
get("base", [])
)
except AttributeError:
cfg_pillar_roots = []
all_pillar_roots.extend(cfg_pillar_roots)

self.add_copy_spec(all_pillar_roots)
Expand Down

0 comments on commit 40ece39

Please sign in to comment.