MCPcopy
hub / github.com/saltstack/salt / _handle_extend

Method _handle_extend

salt/state.py:4538–4569  ·  view source on GitHub ↗

Take the extend dec out of state and apply to the highstate global dec

(self, state, sls, saltenv, errors)

Source from the content-addressed store, hash-verified

4536 state[name]["__env__"] = saltenv
4537
4538 def _handle_extend(self, state, sls, saltenv, errors):
4539 """
4540 Take the extend dec out of state and apply to the highstate global
4541 dec
4542 """
4543 if "extend" in state:
4544 ext = state.pop("extend")
4545 if not isinstance(ext, dict):
4546 errors.append(f"Extension value in SLS '{sls}' is not a dictionary")
4547 return
4548 for name in ext:
4549 if not isinstance(ext[name], dict):
4550 errors.append(
4551 "Extension name '{}' in SLS '{}' is not a dictionary".format(
4552 name, sls
4553 )
4554 )
4555 continue
4556 if "__sls__" not in ext[name]:
4557 ext[name]["__sls__"] = sls
4558 if "__env__" not in ext[name]:
4559 ext[name]["__env__"] = saltenv
4560 for key in list(ext[name]):
4561 if key.startswith("_"):
4562 continue
4563 if not isinstance(ext[name][key], list):
4564 continue
4565 if "." in key:
4566 comps = key.split(".")
4567 ext[name][comps[0]] = ext[name].pop(key)
4568 ext[name][comps[0]].append(comps[1])
4569 state.setdefault("__extend__", []).append(ext)
4570
4571 def _handle_exclude(self, state, sls, saltenv, errors):
4572 """

Callers 1

render_stateMethod · 0.95

Calls 5

formatMethod · 0.80
listFunction · 0.50
popMethod · 0.45
appendMethod · 0.45
setdefaultMethod · 0.45

Tested by

no test coverage detected