HEX
Server: Apache
System: Linux server2.voipitup.com.au 4.18.0-553.109.1.lve.el8.x86_64 #1 SMP Thu Mar 5 20:23:46 UTC 2026 x86_64
User: posscale (1027)
PHP: 8.2.30
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/sdb/__pycache__/yaml.cpython-310.pyc
o

�N�g
�@s~dZddlZddlZddlZddlZddlZddlZddlZe�	e
�ZddiZdd�Z
dd�Zddd	�Zdd
d�Zdd
�ZdS)aD
Pull sdb values from a YAML file

:maintainer:    SaltStack
:maturity:      New
:platform:      all

.. versionadded:: 2017.7.0

Configuration:

.. code-block:: yaml

    my-yaml-file:
      driver: yaml
      files:
        - /path/to/foo.yaml
        - /path/to/bar.yaml

The files are merged together and the result is searched using the same
mechanism Salt uses for searching Grains and Pillar data structures.

Optional configuration:

.. code-block:: yaml

    my-yaml-file:
      driver: yaml
      files:
        - /path/to/foo.yaml
        - /path/to/bar.yaml
      merge:
        strategy: smart
        merge_list: false
      gpg: true

.. versionadded:: 2018.3.0

Setting the ``gpg`` option to ``true`` (default is ``false``) will decrypt
embedded GPG-encrypted data using the :py:mod:`GPG renderer
<salt.renderers.gpg>`.
�N�set_�setcCsdS)NT�rrr�A/opt/saltstack/salt/lib/python3.10/site-packages/salt/sdb/yaml.py�__virtual__:srcOs
tj���)zH
    Setting a value is not supported; edit the YAML files directly
    )�salt�
exceptions�NotImplemented)�args�kwargsrrrr>s
cCs@t|�}|r|�dd�rtjj�t|�|d�Stjj�||d�S)z)
    Get a value from the dictionary
    �gpgFN)�_get_values�getr�utils�dataZtraverse_dict_and_list�_decrypt)�key�profilerrrrrEsrcCs�|pi}tj�t�}i}|�dg�D]X}z/tjj�|��}|j�	|�}tjj
j||fi|�di���}Wd�n1s=wYWqtyRt
�d|�Yqtyj}z
t
�d||�WYd}~qd}~ww|S)zR
    Retrieve all the referenced files, deserialize, then merge them together
    �files�mergeNzFile '%s' not found z%Error deserializing sdb file '%s': %s)r�loader�serializers�__opts__rrrZflopenZyamlZdeserializeZ
dictupdater�OSError�log�error�	TypeError)rr�ret�fnameZyamlfile�contents�excrrrr
Rs*�
�����r
cCstj�tt�d|�S)zS
    Pass the dictionary through the GPG renderer to decrypt encrypted values.
    r)rrZrenderrZ__salt__)rrrrrhsr)N)�__doc__�loggingZsalt.exceptionsrZsalt.loaderZsalt.renderers.gpgZsalt.utils.dataZsalt.utils.dictupdateZsalt.utils.files�	getLogger�__name__rZ__func_alias__rrrr
rrrrr�<module>s+