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

Method pad_funcs

salt/state.py:550–597  ·  view source on GitHub ↗

Turns dot delimited function refs into function strings

(self, high)

Source from the content-addressed store, hash-verified

548 return self.pad_funcs(high)
549
550 def pad_funcs(self, high):
551 """
552 Turns dot delimited function refs into function strings
553 """
554 for name in high:
555 if not isinstance(high[name], dict):
556 if isinstance(high[name], str):
557 # Is this is a short state? It needs to be padded!
558 if "." in high[name]:
559 comps = high[name].split(".")
560 if len(comps) >= 2:
561 # Merge the comps
562 comps[1] = ".".join(comps[1 : len(comps)])
563 high[name] = {
564 # '__sls__': template,
565 # '__env__': None,
566 comps[0]: [comps[1]]
567 }
568 continue
569 continue
570 skeys = set()
571 for key in sorted(high[name]):
572 if key.startswith("_"):
573 continue
574 if not isinstance(high[name][key], list):
575 continue
576 if "." in key:
577 comps = key.split(".")
578 if len(comps) >= 2:
579 # Merge the comps
580 comps[1] = ".".join(comps[1 : len(comps)])
581 # Salt doesn't support state files such as:
582 #
583 # /etc/redis/redis.conf:
584 # file.managed:
585 # - user: redis
586 # - group: redis
587 # - mode: 644
588 # file.comment:
589 # - regex: ^requirepass
590 if comps[0] in skeys:
591 continue
592 high[name][comps[0]] = high[name].pop(key)
593 high[name][comps[0]].append(comps[1])
594 skeys.add(comps[0])
595 continue
596 skeys.add(key)
597 return high
598
599 def verify_high(self, high):
600 """

Callers 3

render_templateMethod · 0.95
test_compiler_pad_funcsFunction · 0.95

Calls 4

setFunction · 0.50
popMethod · 0.45
appendMethod · 0.45
addMethod · 0.45

Tested by 2

test_compiler_pad_funcsFunction · 0.76