MCPcopy Index your code
hub / github.com/saltstack/salt / get

Function get

salt/modules/pillar.py:26–206  ·  view source on GitHub ↗

.. versionadded:: 0.14.0 Attempt to retrieve the named value from :ref:`in-memory pillar data `. If the pillar key is not present in the in-memory pillar, then the value specified in the ``default`` option (described below) will be returned. If the merge

(
    key,
    default=NOT_SET,
    merge=False,
    merge_nested_lists=None,
    delimiter=DEFAULT_TARGET_DELIM,
    pillarenv=None,
    saltenv=None,
    unmask=None,
)

Source from the content-addressed store, hash-verified

24
25
26def get(
27 key,
28 default=NOT_SET,
29 merge=False,
30 merge_nested_lists=None,
31 delimiter=DEFAULT_TARGET_DELIM,
32 pillarenv=None,
33 saltenv=None,
34 unmask=None,
35):
36 """
37 .. versionadded:: 0.14.0
38
39 Attempt to retrieve the named value from :ref:`in-memory pillar data
40 <pillar-in-memory>`. If the pillar key is not present in the in-memory
41 pillar, then the value specified in the ``default`` option (described
42 below) will be returned.
43
44 If the merge parameter is set to ``True``, the default will be recursively
45 merged into the returned pillar data.
46
47 The value can also represent a value in a nested dict using a ":" delimiter
48 for the dict. This means that if a dict in pillar looks like this::
49
50 {'pkg': {'apache': 'httpd'}}
51
52 To retrieve the value associated with the ``apache`` key in the ``pkg``
53 dict this key can be passed as::
54
55 pkg:apache
56
57 key
58 The pillar key to get value from
59
60 default
61 The value specified by this option will be returned if the desired
62 pillar key does not exist.
63
64 If a default value is not specified, then it will be an empty string,
65 unless :conf_minion:`pillar_raise_on_missing` is set to ``True``, in
66 which case an error will be raised.
67
68 merge : ``False``
69 If ``True``, the retrieved values will be merged into the passed
70 default. When the default and the retrieved value are both
71 dictionaries, the dictionaries will be recursively merged.
72
73 .. versionadded:: 2014.7.0
74 .. versionchanged:: 2016.3.7,2016.11.4,2017.7.0
75 If the default and the retrieved value are not of the same type,
76 then merging will be skipped and the retrieved value will be
77 returned. Earlier releases raised an error in these cases.
78
79 merge_nested_lists
80 If set to ``False``, lists nested within the retrieved pillar
81 dictionary will *overwrite* lists in ``default``. If set to ``True``,
82 nested lists will be *merged* into lists in ``default``. If unspecified
83 (the default), this option is inherited from the

Callers

nothing calls this directly

Calls 5

itemsFunction · 0.70
getMethod · 0.45
updateMethod · 0.45
errorMethod · 0.45
extendMethod · 0.45

Tested by

no test coverage detected