mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
specify explicit kwargs for items and ls
This commit is contained in:
parent
296f6648f2
commit
63d83353fa
1 changed files with 44 additions and 7 deletions
|
@ -189,7 +189,7 @@ def get(
|
|||
return ret
|
||||
|
||||
|
||||
def items(*args, **kwargs):
|
||||
def items(*args, pillar=None, pillar_enc=None, pillarenv=None, saltenv=None):
|
||||
"""
|
||||
Calls the master for a fresh pillar and generates the pillar data on the
|
||||
fly
|
||||
|
@ -244,15 +244,13 @@ def items(*args, **kwargs):
|
|||
if args:
|
||||
return item(*args)
|
||||
|
||||
pillarenv = kwargs.get("pillarenv")
|
||||
if pillarenv is None:
|
||||
if __opts__.get("pillarenv_from_saltenv", False):
|
||||
pillarenv = kwargs.get("saltenv") or __opts__["saltenv"]
|
||||
pillarenv = saltenv or __opts__["saltenv"]
|
||||
else:
|
||||
pillarenv = __opts__["pillarenv"]
|
||||
|
||||
pillar_override = kwargs.get("pillar")
|
||||
pillar_enc = kwargs.get("pillar_enc")
|
||||
pillar_override = pillar
|
||||
|
||||
if pillar_override and pillar_enc:
|
||||
try:
|
||||
|
@ -328,13 +326,44 @@ def obfuscate(*args, **kwargs):
|
|||
|
||||
# naming chosen for consistency with grains.ls, although it breaks the short
|
||||
# identifier rule.
|
||||
def ls(*args, **kwargs):
|
||||
def ls(*args, pillar=None, pillar_enc=None, pillarenv=None, saltenv=None):
|
||||
"""
|
||||
.. versionadded:: 2015.8.0
|
||||
|
||||
Calls the master for a fresh pillar, generates the pillar data on the
|
||||
fly (same as :py:func:`items`), but only shows the available main keys.
|
||||
|
||||
pillar
|
||||
If specified, allows for a dictionary of pillar data to be made
|
||||
available to pillar and ext_pillar rendering. these pillar variables
|
||||
will also override any variables of the same name in pillar or
|
||||
ext_pillar.
|
||||
|
||||
pillar_enc
|
||||
If specified, the data passed in the ``pillar`` argument will be passed
|
||||
through this renderer to decrypt it.
|
||||
|
||||
.. note::
|
||||
This will decrypt on the minion side, so the specified renderer
|
||||
must be set up on the minion for this to work. Alternatively,
|
||||
pillar data can be decrypted master-side. For more information, see
|
||||
the :ref:`Pillar Encryption <pillar-encryption>` documentation.
|
||||
Pillar data that is decrypted master-side, is not decrypted until
|
||||
the end of pillar compilation though, so minion-side decryption
|
||||
will be necessary if the encrypted pillar data must be made
|
||||
available in an decrypted state pillar/ext_pillar rendering.
|
||||
|
||||
pillarenv
|
||||
Pass a specific pillar environment from which to compile pillar data.
|
||||
If not specified, then the minion's :conf_minion:`pillarenv` option is
|
||||
not used, and if that also is not specified then all configured pillar
|
||||
environments will be merged into a single pillar dictionary and
|
||||
returned.
|
||||
|
||||
saltenv
|
||||
Included only for compatibility with
|
||||
:conf_minion:`pillarenv_from_saltenv`, and is otherwise ignored.
|
||||
|
||||
CLI Examples:
|
||||
|
||||
.. code-block:: bash
|
||||
|
@ -342,7 +371,15 @@ def ls(*args, **kwargs):
|
|||
salt '*' pillar.ls
|
||||
"""
|
||||
|
||||
return list(items(*args, **kwargs))
|
||||
return list(
|
||||
items(
|
||||
*args,
|
||||
pillar=pillar,
|
||||
pillar_enc=pillar_enc,
|
||||
pillarenv=pillarenv,
|
||||
saltenv=saltenv,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
def item(*args, **kwargs):
|
||||
|
|
Loading…
Add table
Reference in a new issue