003 File Manager
Current Path:
/usr/local/lib/python3.8/site-packages/salt/pillar
usr
/
local
/
lib
/
python3.8
/
site-packages
/
salt
/
pillar
/
📁
..
📄
__init__.py
(48.72 KB)
📁
__pycache__
📄
azureblob.py
(13.88 KB)
📄
cmd_json.py
(787 B)
📄
cmd_yaml.py
(893 B)
📄
cmd_yamlex.py
(674 B)
📄
cobbler.py
(1.64 KB)
📄
confidant.py
(3.29 KB)
📄
consul_pillar.py
(11.61 KB)
📄
csvpillar.py
(1.85 KB)
📄
digicert.py
(1007 B)
📄
django_orm.py
(7.74 KB)
📄
ec2_pillar.py
(10.12 KB)
📄
etcd_pillar.py
(2.36 KB)
📄
extra_minion_data_in_pillar.py
(2.18 KB)
📄
file_tree.py
(18.03 KB)
📄
foreman.py
(3.66 KB)
📄
git_pillar.py
(19.61 KB)
📄
gpg.py
(560 B)
📄
hg_pillar.py
(3.19 KB)
📄
hiera.py
(846 B)
📄
http_json.py
(2.43 KB)
📄
http_yaml.py
(2.43 KB)
📄
libvirt.py
(5.78 KB)
📄
makostack.py
(21.99 KB)
📄
mongo.py
(5.6 KB)
📄
mysql.py
(3.76 KB)
📄
nacl.py
(744 B)
📄
netbox.py
(29.5 KB)
📄
neutron.py
(2.41 KB)
📄
nodegroups.py
(1.7 KB)
📄
pepa.py
(20.98 KB)
📄
pillar_ldap.py
(10.95 KB)
📄
postgres.py
(2.82 KB)
📄
puppet.py
(846 B)
📄
reclass_adapter.py
(4 KB)
📄
redismod.py
(3.28 KB)
📄
rethinkdb_pillar.py
(4.71 KB)
📄
s3.py
(14.4 KB)
📄
saltclass.py
(1.49 KB)
📄
sql_base.py
(15.38 KB)
📄
sqlcipher.py
(3.42 KB)
📄
sqlite3.py
(2.67 KB)
📄
stack.py
(22.07 KB)
📄
svn_pillar.py
(5.74 KB)
📄
varstack_pillar.py
(1.1 KB)
📄
vault.py
(4.03 KB)
📄
venafi.py
(966 B)
📄
virtkey.py
(586 B)
📄
vmware_pillar.py
(16.83 KB)
Editing: csvpillar.py
""" 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', } """ import csv import salt.utils.files __virtualname__ = "csv" def __virtual__(): return __virtualname__ def ext_pillar( mid, pillar, path, idkey="id", namespace=None, fieldnames=None, restkey=None, restval=None, dialect="excel", ): """ 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. """ with salt.utils.files.fopen(path, "r") as f: sheet = csv.DictReader( f, fieldnames, restkey=restkey, restval=restval, dialect=dialect ) for row in sheet: if row[idkey] == mid: if namespace: return {namespace: row} else: return row return {}
Upload File
Create Folder