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

Method __init__

salt/state.py:832–929  ·  view source on GitHub ↗

When instantiating an object of this class, do not pass ``_invocation_id``. It is an internal field for tracking parallel executions where no jid is available (Salt-SSH) and only exposed as an init argument to work on spawning platforms.

(
        self,
        opts,
        pillar_override=None,
        jid=None,
        pillar_enc=None,
        proxy=None,
        context=None,
        mocked=False,
        loader="states",
        initial_pillar=None,
        file_client=None,
        _invocation_id=None,
    )

Source from the content-addressed store, hash-verified

830 """
831
832 def __init__(
833 self,
834 opts,
835 pillar_override=None,
836 jid=None,
837 pillar_enc=None,
838 proxy=None,
839 context=None,
840 mocked=False,
841 loader="states",
842 initial_pillar=None,
843 file_client=None,
844 _invocation_id=None,
845 ):
846 """
847 When instantiating an object of this class, do not pass
848 ``_invocation_id``. It is an internal field for tracking
849 parallel executions where no jid is available (Salt-SSH) and
850 only exposed as an init argument to work on spawning platforms.
851 """
852 if jid is not None:
853 _invocation_id = jid
854 if _invocation_id is None:
855 # For salt-ssh parallel states, we need a unique identifier
856 # for a single execution. self.jid should not be set there
857 # since it's used for other purposes as well.
858 _invocation_id = salt.utils.jid.gen_jid(opts)
859
860 self._init_kwargs = {
861 "opts": opts,
862 "pillar_override": pillar_override,
863 "jid": jid,
864 "pillar_enc": pillar_enc,
865 "proxy": proxy,
866 "context": context,
867 "mocked": mocked,
868 "loader": loader,
869 "initial_pillar": initial_pillar,
870 "_invocation_id": _invocation_id,
871 }
872 self.states_loader = loader
873 if "grains" not in opts:
874 opts["grains"] = salt.loader.grains(opts)
875 self.opts = opts
876 if file_client:
877 self.file_client = file_client
878 self.preserve_file_client = True
879 else:
880 self.file_client = salt.fileclient.get_file_client(self.opts)
881 self.preserve_file_client = False
882 self.proxy = proxy
883 self._pillar_override = pillar_override
884 if pillar_enc is not None:
885 try:
886 pillar_enc = pillar_enc.lower()
887 except AttributeError:
888 pillar_enc = str(pillar_enc).lower()
889 self._pillar_enc = pillar_enc

Callers 3

__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45

Calls 8

_gather_pillarMethod · 0.95
load_modulesMethod · 0.95
DependencyGraphClass · 0.90
grainsMethod · 0.80
debugMethod · 0.80
mergeMethod · 0.80
setFunction · 0.50
getMethod · 0.45

Tested by

no test coverage detected