Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

more clarification/info on dunder objects #12126

Merged
merged 2 commits into from Apr 18, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 15 additions & 6 deletions salt/renderers/py.py
Expand Up @@ -8,13 +8,22 @@
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__`` - :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
* ``__sls__`` - The SLS path of the file. For example, if the root of the base
- ``__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``.
Expand Down