%PDF- %PDF-
Direktori : /lib/python2.7/site-packages/salt/pillar/ |
Current File : //lib/python2.7/site-packages/salt/pillar/csvpillar.pyo |
� ���^c @@ sh d Z d d l m Z m Z m Z d d l Z d d l Z d Z d � Z d d d d d d d � Z d S( uf 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', } i ( t absolute_importt print_functiont unicode_literalsNu csvc C@ s t S( N( t __virtualname__( ( ( s9 /usr/lib/python2.7/site-packages/salt/pillar/csvpillar.pyt __virtual__8 s u idu excelc C@ s� t j j j | d � �d } t j | | d | d | d | �} x6 | D]. } | | | k rF | rm i | | 6S| SqF qF WWd QXi S( ug 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. u rbt restkeyt restvalt dialectN( t saltt utilst filest fopent csvt DictReader( t midt pillart patht idkeyt namespacet fieldnamesR R R t ft sheett row( ( s9 /usr/lib/python2.7/site-packages/salt/pillar/csvpillar.pyt ext_pillar<