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: hg_pillar.py
# Β Copyright (C) 2014 Floris Bruynooghe <flub@devork.be> r""" Use remote Mercurial repository as a Pillar source. .. versionadded:: 2015.8.0 The module depends on the ``hglib`` python module being available. This is the same requirement as for hgfs\_ so should not pose any extra hurdles. This external Pillar source can be configured in the master config file as such: .. code-block:: yaml ext_pillar: - hg: ssh://hg@example.co/user/repo """ import copy import hashlib import logging import os import salt.pillar import salt.utils.stringutils try: import hglib except ImportError: hglib = None __virtualname__ = "hg" log = logging.getLogger(__name__) # The default option values __opts__ = {} def __virtual__(): """ Only load if hglib is available. """ ext_pillar_sources = [x for x in __opts__.get("ext_pillar", [])] if not any(["hg" in x for x in ext_pillar_sources]): return False if not hglib: log.error("hglib not present") return False return __virtualname__ def __init__(__opts__): """ Initialise This is called every time a minion calls this external pillar. """ def ext_pillar(minion_id, pillar, repo, branch="default", root=None): """ Extract pillar from an hg repository """ with Repo(repo) as repo: repo.update(branch) envname = "base" if branch == "default" else branch if root: path = os.path.normpath(os.path.join(repo.working_dir, root)) else: path = repo.working_dir opts = copy.deepcopy(__opts__) opts["pillar_roots"][envname] = [path] pil = salt.pillar.Pillar(opts, __grains__, minion_id, envname) return pil.compile_pillar(ext=False) def update(repo_uri): """ Execute an hg pull on all the repos """ with Repo(repo_uri) as repo: repo.pull() class Repo: """ Deal with remote hg (mercurial) repository for Pillar """ def __init__(self, repo_uri): """Initialize a hg repo (or open it if it already exists)""" self.repo_uri = repo_uri cachedir = os.path.join(__opts__["cachedir"], "hg_pillar") hash_type = getattr(hashlib, __opts__.get("hash_type", "md5")) repo_hash = hash_type(salt.utils.stringutils.to_bytes(repo_uri)).hexdigest() self.working_dir = os.path.join(cachedir, repo_hash) if not os.path.isdir(self.working_dir): self.repo = hglib.clone(repo_uri, self.working_dir) self.repo.open() else: self.repo = hglib.open(self.working_dir) def pull(self): log.debug("Updating hg repo from hg_pillar module (pull)") self.repo.pull() def update(self, branch="default"): """ Ensure we are using the latest revision in the hg repository """ log.debug("Updating hg repo from hg_pillar module (pull)") self.repo.pull() log.debug("Updating hg repo from hg_pillar module (update)") self.repo.update(branch, clean=True) def close(self): """ Cleanup mercurial command server """ self.repo.close() def __enter__(self): return self def __exit__(self, exc_type, exc_value, traceback): self.close()
Upload File
Create Folder