mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 17:33:54 +00:00
allow top cfg to be YAML for consistency and flexibility (current syntax does not allow blank lines or comments) (#33189)
This commit is contained in:
parent
6654d15daa
commit
1e636f141f
@ -412,7 +412,7 @@ def _process_stack_cfg(cfg, stack, minion_id, pillar):
|
||||
"minion_id": minion_id,
|
||||
"pillar": pillar,
|
||||
})
|
||||
for path in jenv.get_template(filename).render(stack=stack).splitlines():
|
||||
for path in _parse_top_cfg(jenv.get_template(filename).render(stack=stack)):
|
||||
try:
|
||||
obj = yaml.safe_load(jenv.get_template(path).render(stack=stack))
|
||||
if not isinstance(obj, dict):
|
||||
@ -495,3 +495,14 @@ def _merge_list(stack, obj):
|
||||
return obj + stack
|
||||
else:
|
||||
return stack + obj
|
||||
|
||||
|
||||
def _parse_top_cfg(content):
|
||||
"""Allow top_cfg to be YAML"""
|
||||
try:
|
||||
obj = yaml.safe_load(content)
|
||||
if isinstance(obj, list):
|
||||
return obj
|
||||
except Exception as e:
|
||||
pass
|
||||
return content.splitlines()
|
||||
|
Loading…
Reference in New Issue
Block a user