mirror of
https://github.com/saltstack/salt.git
synced 2025-04-16 01:30:20 +00:00
Ignore extend declarations from excluded sls files
sls files that are excluded should not affect other sls files by extending their states. Exclude statements are processed very late in the state processing pipeline to ensure they are not overridden. By that time, extend declarations are already processed. Luckily, it's not necessary to change much, during the extend declarations processing it is easy to check if the sls file that contains a given extend declaration is excluded.
This commit is contained in:
parent
e91c1a608b
commit
856b23c45d
2 changed files with 20 additions and 0 deletions
1
changelog/62082.fixed
Normal file
1
changelog/62082.fixed
Normal file
|
@ -0,0 +1 @@
|
|||
Ignore extend declarations in sls files that are excluded.
|
|
@ -1685,6 +1685,25 @@ class State:
|
|||
else:
|
||||
name = ids[0][0]
|
||||
|
||||
sls_excludes = []
|
||||
# excluded sls are plain list items or dicts with an "sls" key
|
||||
for exclude in high.get("__exclude__", []):
|
||||
if isinstance(exclude, str):
|
||||
sls_excludes.append(exclude)
|
||||
elif exclude.get("sls"):
|
||||
sls_excludes.append(exclude["sls"])
|
||||
|
||||
if body.get("__sls__") in sls_excludes:
|
||||
log.debug(
|
||||
"Cannot extend ID '%s' in '%s:%s' because '%s:%s' is excluded.",
|
||||
name,
|
||||
body.get("__env__", "base"),
|
||||
body.get("__sls__", "base"),
|
||||
body.get("__env__", "base"),
|
||||
body.get("__sls__", "base"),
|
||||
)
|
||||
continue
|
||||
|
||||
for state, run in body.items():
|
||||
if state.startswith("__"):
|
||||
continue
|
||||
|
|
Loading…
Add table
Reference in a new issue