mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Minor fixes to Developer Docs (#28302)
* Grammar and formatting corrections Indent JSON code example. Double backticks for inline code examples. * Remove trailing spaces * CI fixes
This commit is contained in:
parent
2960f5feac
commit
b7aa38c0d8
2 changed files with 22 additions and 19 deletions
|
@ -96,7 +96,7 @@ Version 1.1 of the metadata
|
||||||
+++++++++++++++++++++++++++
|
+++++++++++++++++++++++++++
|
||||||
|
|
||||||
Structure
|
Structure
|
||||||
`````````
|
^^^^^^^^^
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ Structure
|
||||||
}
|
}
|
||||||
|
|
||||||
Fields
|
Fields
|
||||||
``````
|
^^^^^^
|
||||||
|
|
||||||
:metadata_version: An “X.Y” formatted string. X and Y are integers which
|
:metadata_version: An “X.Y” formatted string. X and Y are integers which
|
||||||
define the metadata format version. Modules shipped with Ansible are
|
define the metadata format version. Modules shipped with Ansible are
|
||||||
|
@ -406,6 +406,8 @@ accepts a comma-separated list of module names. To skip building
|
||||||
documentation for all modules, specify a non-existent module name, for example:
|
documentation for all modules, specify a non-existent module name, for example:
|
||||||
``MODULES=none make webdocs``.
|
``MODULES=none make webdocs``.
|
||||||
|
|
||||||
|
You may also build a single page of the entire docsite. From ``ansible/docs/docsite`` run ``make htmlsingle rst=[relative path to the .rst file]``, for example: ``make htmlsingle rst=dev_guide/developing_modules_documenting.rst``
|
||||||
|
|
||||||
To test your documentation against your ``argument_spec`` you can use ``validate-modules``. Note that this option isn't currently enabled in Shippable due to the time it takes to run.
|
To test your documentation against your ``argument_spec`` you can use ``validate-modules``. Note that this option isn't currently enabled in Shippable due to the time it takes to run.
|
||||||
|
|
||||||
.. code-block:: bash
|
.. code-block:: bash
|
||||||
|
|
|
@ -51,7 +51,9 @@ working on a whole new file. Here is an example:
|
||||||
- Navigate to the directory that you want to develop your new module
|
- Navigate to the directory that you want to develop your new module
|
||||||
in. E.g. ``$ cd lib/ansible/modules/cloud/azure/``
|
in. E.g. ``$ cd lib/ansible/modules/cloud/azure/``
|
||||||
- Create your new module file: ``$ touch my_new_test_module.py``
|
- Create your new module file: ``$ touch my_new_test_module.py``
|
||||||
- Paste this simple into the new module file: (explanation in comments)::
|
- Paste this example code into the new module file: (explanation in comments)
|
||||||
|
|
||||||
|
.. code:: python
|
||||||
|
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
|
||||||
|
@ -205,7 +207,7 @@ that can run locally.
|
||||||
This should be working output that resembles something like the
|
This should be working output that resembles something like the
|
||||||
following:
|
following:
|
||||||
|
|
||||||
::
|
.. code:: json
|
||||||
|
|
||||||
{"changed": true, "state": {"original_message": "hello", "new_message": "goodbye"}, "invocation": {"module_args": {"name": "hello", "new": true}}}
|
{"changed": true, "state": {"original_message": "hello", "new_message": "goodbye"}, "invocation": {"module_args": {"name": "hello", "new": true}}}
|
||||||
|
|
||||||
|
@ -221,7 +223,6 @@ Ansible playbook.
|
||||||
- Create a playbook in any directory: ``$ touch testmod.yml``
|
- Create a playbook in any directory: ``$ touch testmod.yml``
|
||||||
- Add the following to the new playbook file::
|
- Add the following to the new playbook file::
|
||||||
|
|
||||||
---
|
|
||||||
- name: test my new module
|
- name: test my new module
|
||||||
connection: local
|
connection: local
|
||||||
hosts: localhost
|
hosts: localhost
|
||||||
|
@ -242,7 +243,7 @@ Debugging (local)
|
||||||
|
|
||||||
If you want to break into a module and step through with the debugger, locally running the module you can do:
|
If you want to break into a module and step through with the debugger, locally running the module you can do:
|
||||||
|
|
||||||
- Set a breakpoint in the module: `import pdb; pdb.set_trace()`
|
- Set a breakpoint in the module: ``import pdb; pdb.set_trace()``
|
||||||
- Run the module on the local machine: ``$ python -m pdb ./my_new_test_module.py ./args.json``
|
- Run the module on the local machine: ``$ python -m pdb ./my_new_test_module.py ./args.json``
|
||||||
|
|
||||||
Debugging (remote)
|
Debugging (remote)
|
||||||
|
|
Loading…
Reference in a new issue