mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-24 04:39:15 +00:00
Make all doc fragments, module utils, and plugin utils private (#11896)
* Make all doc fragments private. * Make all plugin utils private. * Make all module utils private. * Reformat. * Changelog fragment. * Update configs and ignores. * Adjust unit test names.
This commit is contained in:
parent
9ef1dbb6d5
commit
4fa82b9617
807 changed files with 2041 additions and 1702 deletions
|
|
@ -13,7 +13,7 @@ Command Runner guide
|
|||
Introduction
|
||||
^^^^^^^^^^^^
|
||||
|
||||
The ``ansible_collections.community.general.plugins.module_utils.cmd_runner`` module util provides the
|
||||
The ``ansible_collections.community.general.plugins.module_utils._cmd_runner`` module util provides the
|
||||
``CmdRunner`` class to help execute external commands. The class is a wrapper around
|
||||
the standard ``AnsibleModule.run_command()`` method, handling command arguments, localization setting,
|
||||
output processing output, check mode, and other features.
|
||||
|
|
@ -38,7 +38,7 @@ version of the actual code in :ansplugin:`community.general.ansible_galaxy_insta
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.cmd_runner import CmdRunner, cmd_runner_fmt
|
||||
from ansible_collections.community.general.plugins.module_utils._cmd_runner import CmdRunner, cmd_runner_fmt
|
||||
|
||||
runner = CmdRunner(
|
||||
module,
|
||||
|
|
@ -151,7 +151,7 @@ that class:
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.cmd_runner import CmdRunner, cmd_runner_fmt
|
||||
from ansible_collections.community.general.plugins.module_utils._cmd_runner import CmdRunner, cmd_runner_fmt
|
||||
|
||||
The same example shows how to make use of some of them in the instantiation of the ``CmdRunner`` object.
|
||||
A description of each one of the convenience methods available and examples of how to use them is found below.
|
||||
|
|
@ -354,7 +354,7 @@ Some additional features are available as decorators:
|
|||
- ``cmd_runner_fmt.unpack args()``
|
||||
This decorator unpacks the incoming ``value`` as a list of elements.
|
||||
|
||||
For example, in ``ansible_collections.community.general.plugins.module_utils.puppet``, it is used as:
|
||||
For example, in ``ansible_collections.community.general.plugins.module_utils._puppet``, it is used as:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
|
|
@ -492,8 +492,8 @@ Python scripts. It features two extra and mutually exclusive parameters ``pytho
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.python_runner import PythonRunner
|
||||
from ansible_collections.community.general.plugins.module_utils.cmd_runner import cmd_runner_fmt
|
||||
from ansible_collections.community.general.plugins.module_utils._python_runner import PythonRunner
|
||||
from ansible_collections.community.general.plugins.module_utils._cmd_runner import cmd_runner_fmt
|
||||
|
||||
runner = PythonRunner(
|
||||
module,
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
Using ``deps``
|
||||
^^^^^^^^^^^^^^
|
||||
|
||||
The ``ansible_collections.community.general.plugins.module_utils.deps`` module util simplifies
|
||||
The ``ansible_collections.community.general.plugins.module_utils._deps`` module util simplifies
|
||||
the importing of code as described in :ref:`Importing and using shared code <shared_code>`.
|
||||
Please notice that ``deps`` is meant to be used specifically with Ansible modules, and not other types of plugins.
|
||||
|
||||
|
|
@ -20,7 +20,7 @@ The same example from the Developer Guide would become:
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils import deps
|
||||
from ansible_collections.community.general.plugins.module_utils import _deps as deps
|
||||
|
||||
|
||||
with deps.declare("foo"):
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ But bear in mind that it does not showcase all of MH's features:
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.module_helper import ModuleHelper
|
||||
from ansible_collections.community.general.plugins.module_utils._module_helper import ModuleHelper
|
||||
|
||||
|
||||
class MyTest(ModuleHelper):
|
||||
|
|
@ -72,7 +72,7 @@ section above, but there are more elements that will take part in it.
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.module_helper import ModuleHelper
|
||||
from ansible_collections.community.general.plugins.module_utils._module_helper import ModuleHelper
|
||||
|
||||
|
||||
class MyTest(ModuleHelper):
|
||||
|
|
@ -354,7 +354,7 @@ However, you can set output variables specifically for that exception, if you so
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.module_helper import ModuleHelperException
|
||||
from ansible_collections.community.general.plugins.module_utils._module_helper import ModuleHelperException
|
||||
|
||||
def __init_module__(self):
|
||||
if not complex_validation():
|
||||
|
|
@ -385,7 +385,7 @@ By using ``StateModuleHelper`` you can make your code like the excerpt from the
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.module_helper import StateModuleHelper
|
||||
from ansible_collections.community.general.plugins.module_utils._module_helper import StateModuleHelper
|
||||
|
||||
class GConftool(StateModuleHelper):
|
||||
...
|
||||
|
|
@ -501,7 +501,7 @@ The value of ``changed`` in the module output will be set to ``True``:
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.module_helper import cause_changes
|
||||
from ansible_collections.community.general.plugins.module_utils._module_helper import cause_changes
|
||||
|
||||
# adapted excerpt from the community.general.jira module
|
||||
class JIRA(StateModuleHelper):
|
||||
|
|
@ -528,7 +528,7 @@ The return value in that case is ``None``.
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.module_helper import check_mode_skip
|
||||
from ansible_collections.community.general.plugins.module_utils._module_helper import check_mode_skip
|
||||
|
||||
# adapted excerpt from the community.general.locale_gen module
|
||||
class LocaleGen(StateModuleHelper):
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ VarDict Guide
|
|||
Introduction
|
||||
^^^^^^^^^^^^
|
||||
|
||||
The ``ansible_collections.community.general.plugins.module_utils.vardict`` module util provides the
|
||||
The ``ansible_collections.community.general.plugins.module_utils._vardict`` module util provides the
|
||||
``VarDict`` class to help manage the module variables. That class is a container for module variables,
|
||||
especially the ones for which the module must keep track of state changes, and the ones that should
|
||||
be published as return values.
|
||||
|
|
@ -26,7 +26,7 @@ The simplest way of using ``VarDict`` is:
|
|||
|
||||
.. code-block:: python
|
||||
|
||||
from ansible_collections.community.general.plugins.module_utils.vardict import VarDict
|
||||
from ansible_collections.community.general.plugins.module_utils._vardict import VarDict
|
||||
|
||||
Then in ``main()``, or any other function called from there:
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue