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
|
||||
`````````
|
||||
^^^^^^^^^
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
|
@ -107,7 +107,7 @@ Structure
|
|||
}
|
||||
|
||||
Fields
|
||||
``````
|
||||
^^^^^^
|
||||
|
||||
:metadata_version: An “X.Y” formatted string. X and Y are integers which
|
||||
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:
|
||||
``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.
|
||||
|
||||
.. 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
|
||||
in. E.g. ``$ cd lib/ansible/modules/cloud/azure/``
|
||||
- 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
|
||||
|
||||
|
@ -187,14 +189,14 @@ that can run locally.
|
|||
- Create an arguments file in ``/tmp/args.json`` with the following
|
||||
content: (explanation below)
|
||||
|
||||
.. code:: json
|
||||
.. code:: json
|
||||
|
||||
{
|
||||
"ANSIBLE_MODULE_ARGS": {
|
||||
"name": "hello",
|
||||
"new": true
|
||||
}
|
||||
}
|
||||
{
|
||||
"ANSIBLE_MODULE_ARGS": {
|
||||
"name": "hello",
|
||||
"new": true
|
||||
}
|
||||
}
|
||||
|
||||
- If you are using a virtual environment (highly recommended for
|
||||
development) activate it: ``$ . venv/bin/activate``
|
||||
|
@ -205,7 +207,7 @@ that can run locally.
|
|||
This should be working output that resembles something like the
|
||||
following:
|
||||
|
||||
::
|
||||
.. code:: json
|
||||
|
||||
{"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``
|
||||
- Add the following to the new playbook file::
|
||||
|
||||
---
|
||||
- name: test my new module
|
||||
connection: local
|
||||
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:
|
||||
|
||||
- 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``
|
||||
|
||||
Debugging (remote)
|
||||
|
|
Loading…
Reference in a new issue