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/pillar/__pycache__/csvpillar.cpython-310.pyc
o

�N�gf�@s:dZddlZddlZdZdd�Z						d
dd	�ZdS)af
Store key/value pairs in a CSV file

.. versionadded:: 2016.11.0

Example configuration:

.. code-block:: yaml

    ext_pillar:
      - csv: /path/to/file.csv

    # or

    ext_pillar:
      - csv:
          path: /path/to/file.csv
          namespace: 'subkey'
          fieldnames:
          - col1
          - col2
          - col2

The first column must be minion IDs and the first row must be dictionary keys.
E.g.:

==========  =========   ======
id          role        env
==========  =========   ======
jerry       web         prod
stuart      web         stage
dave        web         qa
phil        db          prod
kevin       db          stage
mike        db          qa
==========  =========   ======

Will produce the following Pillar values for a minion named "jerry":

.. code-block:: python

    {
        'role': 'web',
        'env': 'prod',
    }
�N�csvcCstS)N)�__virtualname__�rr�I/opt/saltstack/salt/lib/python3.10/site-packages/salt/pillar/csvpillar.py�__virtual__7sr�id�excelc	Cs�tjj�|d��8}	tj|	||||d�}
|
D]"}|||kr7|r,||iWd�S|Wd�SqWd�iS1sCwYiS)ag
    Read a CSV into Pillar

    :param str path: Absolute path to a CSV file.
    :param str idkey: (Optional) The column name of minion IDs.
    :param str namespace: (Optional) A pillar key to namespace the values under.
    :param list fieldnames: (Optional) if the first row of the CSV is not
        column names they may be specified here instead.
    �r)�restkey�restval�dialectN)�salt�utils�filesZfopenrZ
DictReader)ZmidZpillar�pathZidkey�	namespaceZ
fieldnamesr
rr�fZsheet�rowrrr�
ext_pillar;s"
�
�
��
��r)rNNNNr)�__doc__rZsalt.utils.filesr
rrrrrrr�<module>s/�