Update documentation to reflect __file_client__

This commit is contained in:
Daniel A. Wozniak 2023-12-02 15:06:02 -07:00 committed by Daniel Wozniak
parent 21a3f6aa30
commit 9fb71a7559

View file

@ -155,7 +155,7 @@ The following dunder dictionaries are always defined, but may be empty
__opts__
--------
..versionchanged:: 3006.0
.. versionchanged:: 3006.0
The ``__opts__`` dictionary can now be accessed via
:py:mod:`~salt.loader.context``.
@ -248,13 +248,6 @@ executions until the modules are refreshed; such as when
:py:func:`saltutil.sync_all <salt.modules.saltutil.sync_all>` or
:py:func:`state.apply <salt.modules.state.apply_>` are executed.
A great place to see how to use ``__context__`` is in the cp.py module in
salt/modules/cp.py. The fileclient authenticates with the master when it is
instantiated and then is used to copy files to the minion. Rather than create a
new fileclient for each file that is to be copied down, one instance of the
fileclient is instantiated in the ``__context__`` dictionary and is reused for
each file. Here is an example from salt/modules/cp.py:
.. code-block:: python
if not "cp.fileclient" in __context__:
@ -303,3 +296,13 @@ Defined in: State
__sdb__
-------
Defined in: SDB
__file_client__
---------------
.. versionchanged:: 3006.5
The ``__file_client__`` dunder was added to states and execution modules. This
enables the use of a file client without haveing to instantiate one in
the module.