mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 08:58:59 +00:00
Add more dunder dict docs per @cachedout
There are still a few esoterics to get in from some of the backend module systems, but these are the big ones
This commit is contained in:
parent
90be4d0252
commit
8daa55f7d7
@ -8,6 +8,80 @@ others. This document will describe each dictionary and detail where they exist
|
|||||||
and what information and/or functionality they provide.
|
and what information and/or functionality they provide.
|
||||||
|
|
||||||
|
|
||||||
|
__opts__
|
||||||
|
--------
|
||||||
|
|
||||||
|
Available in
|
||||||
|
~~~~~~~~~~~~
|
||||||
|
|
||||||
|
- All loader modules
|
||||||
|
|
||||||
|
The ``__opts__`` dictionary contains all of the options passed in the
|
||||||
|
configuration file for the master or minion.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
In many places in salt, instead of pulling raw data from the __opts__
|
||||||
|
dict, configuration data should be pulled from the salt `get` frunctions
|
||||||
|
such as config.get, aka - __salt__['config.get']('foo:bar')
|
||||||
|
The `get` functions also allow for dict traversal via the *:* delimiter.
|
||||||
|
Consider using get functions whenever using __opts__ or __pillar__ and
|
||||||
|
__grains__ (when using grains for configuration data)
|
||||||
|
|
||||||
|
The configuration file data made available in the ``__opts__`` dictionary is the
|
||||||
|
configuration data relative to the running daemon. If the modules are loaded and
|
||||||
|
executed by the master, then the master configuration data is available, if the
|
||||||
|
modules are executed by the minion, then the minion configuration is
|
||||||
|
available. Any additional information passed into the respective configuration
|
||||||
|
files is made available
|
||||||
|
|
||||||
|
__salt__
|
||||||
|
--------
|
||||||
|
|
||||||
|
Available in
|
||||||
|
~~~~~~~~~~~~
|
||||||
|
|
||||||
|
- Execution Modules
|
||||||
|
- State Modules
|
||||||
|
- Returners
|
||||||
|
|
||||||
|
``__salt__`` contains the execution module functions. This allows for all
|
||||||
|
functions to be called as they have been set up by the salt loader.
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
__salt__['cmd.run']('fdisk -l')
|
||||||
|
__salt__['network.ip_addrs']()
|
||||||
|
|
||||||
|
__grains__
|
||||||
|
----------
|
||||||
|
|
||||||
|
Available in
|
||||||
|
~~~~~~~~~~~~
|
||||||
|
|
||||||
|
- Execution Modules
|
||||||
|
- State Modules
|
||||||
|
- Returners
|
||||||
|
- External Pillar
|
||||||
|
|
||||||
|
The ``__grains__`` dictionary contains the grains data generated by the minion
|
||||||
|
that is currently being worked with. In execution modules, state modules and
|
||||||
|
returners this is the grains of the minion running the calls, when generating
|
||||||
|
the external pillar the ``__grains__`` is the grains data from the minion that
|
||||||
|
the pillar is being generated for.
|
||||||
|
|
||||||
|
__pillar__
|
||||||
|
-----------
|
||||||
|
|
||||||
|
Available in
|
||||||
|
~~~~~~~~~~~~
|
||||||
|
|
||||||
|
- Execution Modules
|
||||||
|
- State Modules
|
||||||
|
- Returners
|
||||||
|
|
||||||
|
The ``__pillar__`` dictionary contains the pillar for the respective minion.
|
||||||
|
|
||||||
__context__
|
__context__
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user