Linux server.edchosting.com 4.18.0-553.79.1.lve.el7h.x86_64 #1 SMP Wed Oct 15 16:34:46 UTC 2025 x86_64
LiteSpeed
Server IP : 75.98.162.185 & Your IP : 216.73.216.163
Domains :
Cant Read [ /etc/named.conf ]
User : goons4good
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
lib /
python3.6 /
site-packages /
salt /
renderers /
Delete
Unzip
Name
Size
Permission
Date
Action
__pycache__
[ DIR ]
drwxr-xr-x
2022-10-11 05:09
__init__.py
28
B
-rw-r--r--
2022-05-16 09:16
aws_kms.py
8.03
KB
-rw-r--r--
2022-05-16 09:16
cheetah.py
644
B
-rw-r--r--
2022-05-16 09:16
dson.py
1.01
KB
-rw-r--r--
2022-05-16 09:16
genshi.py
1.27
KB
-rw-r--r--
2022-05-16 09:16
gpg.py
13.4
KB
-rw-r--r--
2022-05-16 09:16
hjson.py
677
B
-rw-r--r--
2022-05-16 09:16
jinja.py
2.16
KB
-rw-r--r--
2022-05-16 09:16
json.py
546
B
-rw-r--r--
2022-05-16 09:16
json5.py
1.03
KB
-rw-r--r--
2022-05-16 09:16
mako.py
838
B
-rw-r--r--
2022-05-16 09:16
msgpack.py
834
B
-rw-r--r--
2022-05-16 09:16
nacl.py
2.64
KB
-rw-r--r--
2022-05-16 09:16
pass.py
2.91
KB
-rw-r--r--
2022-05-16 09:16
py.py
4.17
KB
-rw-r--r--
2022-05-16 09:16
pydsl.py
12.99
KB
-rw-r--r--
2022-05-16 09:16
pyobjects.py
16.4
KB
-rw-r--r--
2022-05-16 09:16
stateconf.py
19.48
KB
-rw-r--r--
2022-05-16 09:16
tomlmod.py
906
B
-rw-r--r--
2022-05-16 09:16
wempy.py
761
B
-rw-r--r--
2022-05-16 09:16
yaml.py
3.12
KB
-rw-r--r--
2022-05-16 09:16
yamlex.py
735
B
-rw-r--r--
2022-05-16 09:16
Save
Rename
""" Pure python state renderer ========================== To use this renderer, the SLS file should contain a function called ``run`` which returns highstate data. The highstate data is a dictionary containing identifiers as keys, and execution dictionaries as values. For example the following state declaration in YAML: .. code-block:: yaml common_packages: pkg.installed: - pkgs: - curl - vim translates to: .. code-block:: python {'common_packages': {'pkg.installed': [{'pkgs': ['curl', 'vim']}]}} In this module, a few objects are defined for you, giving access to Salt's execution functions, grains, pillar, etc. They are: - ``__salt__`` - :ref:`Execution functions <all-salt.modules>` (i.e. ``__salt__['test.echo']('foo')``) - ``__grains__`` - :ref:`Grains <targeting-grains>` (i.e. ``__grains__['os']``) - ``__pillar__`` - :ref:`Pillar data <pillar>` (i.e. ``__pillar__['foo']``) - ``__opts__`` - Minion configuration options - ``__env__`` - The effective salt fileserver environment (i.e. ``base``). Also referred to as a "saltenv". ``__env__`` should not be modified in a pure python SLS file. To use a different environment, the environment should be set when executing the state. This can be done in a couple different ways: - Using the ``saltenv`` argument on the salt CLI (i.e. ``salt '*' state.sls foo.bar.baz saltenv=env_name``). - By adding a ``saltenv`` argument to an individual state within the SLS file. In other words, adding a line like this to the state's data structure: ``{'saltenv': 'env_name'}`` - ``__sls__`` - The SLS path of the file. For example, if the root of the base environment is ``/srv/salt``, and the SLS file is ``/srv/salt/foo/bar/baz.sls``, then ``__sls__`` in that file will be ``foo.bar.baz``. When writing a reactor SLS file the global context ``data`` (same as context ``{{ data }}`` for states written with Jinja + YAML) is available. The following YAML + Jinja state declaration: .. code-block:: jinja {% if data['id'] == 'mysql1' %} highstate_run: local.state.apply: - tgt: mysql1 {% endif %} translates to: .. code-block:: python if data['id'] == 'mysql1': return {'highstate_run': {'local.state.apply': [{'tgt': 'mysql1'}]}} Full Example ------------ .. code-block:: python :linenos: #!py def run(): config = {} if __grains__['os'] == 'Ubuntu': user = 'ubuntu' group = 'ubuntu' home = '/home/{0}'.format(user) else: user = 'root' group = 'root' home = '/root/' config['s3cmd'] = { 'pkg': [ 'installed', {'name': 's3cmd'}, ], } config[home + '/.s3cfg'] = { 'file.managed': [ {'source': 'salt://s3cfg/templates/s3cfg'}, {'template': 'jinja'}, {'user': user}, {'group': group}, {'mode': 600}, {'context': { 'aws_key': __pillar__['AWS_ACCESS_KEY_ID'], 'aws_secret_key': __pillar__['AWS_SECRET_ACCESS_KEY'], }, }, ], } return config """ import os import salt.utils.templates from salt.exceptions import SaltRenderError def render(template, saltenv="base", sls="", tmplpath=None, **kws): """ Render the python module's components :rtype: string """ template = tmplpath if not os.path.isfile(template): raise SaltRenderError("Template {} is not a file!".format(template)) tmp_data = salt.utils.templates.py( template, True, __salt__=__salt__, salt=__salt__, __grains__=__grains__, grains=__grains__, __opts__=__opts__, opts=__opts__, __pillar__=__pillar__, pillar=__pillar__, __env__=saltenv, saltenv=saltenv, __sls__=sls, sls=sls, **kws ) if not tmp_data.get("result", False): raise SaltRenderError( tmp_data.get("data", "Unknown render error in py renderer") ) return tmp_data["data"]