Skip to content

Commit

Permalink
doc: add vmware_rest_guidelines
Browse files Browse the repository at this point in the history
Add the development guidelines for the vmware_rest collection.
  • Loading branch information
goneri committed Sep 25, 2020
1 parent 2782682 commit c100514
Show file tree
Hide file tree
Showing 3 changed files with 124 additions and 0 deletions.
12 changes: 12 additions & 0 deletions docs/docsite/rst/community/contributing_maintained_collections.rst
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,18 @@ The following table shows:
<td>✓</td>
<td><a href="https://docs.ansible.com/ansible/devel/network/dev_guide/index.html">Network guide</a></td>
</tr>
<tr>
<td><a href="https://galaxy.ansible.com/vmware/vmware_rest">vmware.vmware_rest</a></td>
<td></td>
<td><a href="https://github.com/ansible/community/wiki/Network">Network</a></td>
<td>✓</td>
<td>✓</td>
<td>✓</td>
<td>Zuul</td>
<td>✓</td>
<td><a href="https://docs.ansible.com/ansible/devel/dev_guide/platforms/vmware_rest_guidelines.html">VMWare REST guide</a></td>
</tr>

</table>


Expand Down
1 change: 1 addition & 0 deletions docs/docsite/rst/dev_guide/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ If you prefer to read the entire guide, here's a list of the pages in order.
platforms/openstack_guidelines
platforms/ovirt_dev_guide
platforms/vmware_guidelines
platforms/vmware_rest_guidelines
developing_modules_in_groups
testing
module_lifecycle
Expand Down
111 changes: 111 additions & 0 deletions docs/docsite/rst/dev_guide/platforms/vmware_rest_guidelines.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
.. _VMware_REST_module_development:

*********************************************
Guidelines for VMware REST module development
*********************************************

The Ansible VMware REST collection (on `Galaxy <https://galaxy.ansible.com/vmware/vmware_rest>`_, source code `repository <https://github.com/ansible-collections/vmware.vmware_rest>`_) is maintained by Red Hat and the community.

.. contents::
:local:

Contribution process
====================

The modules of the vmware_rest collection are autogenerated by another tool called `vmware_rest_code_generator <https://github.com/ansible-collections/vmware_rest_code_generator>`.

If you would like to contribute a change, we would appreciate if you:

- submit a Github Pull Request (PR) against the vmware_rest_code_generator project
- but also ensure the generated modules are compliant with our quality criterias.

Requirements
============

You will need:

- Python 3.6 or greater
- the `tox <https://tox.readthedocs.io/en/latest/install.html>` command


vmware_rest_code_generator
==========================

Your contribution should follow the coding style of `Black <https://github.com/psf/black>`.
To run the code formatter, just run:

.. code-block:: shell
tox -e black
To regenerate the vmware_rest collection, you can use the following commands:

.. code-block:: shell
tox -e refresh_modules -- --target-dir ~/.ansible/collections/ansible_collections/vmware/vmware_rest
If you also want to update the EXAMPLE section of the modules, run:

.. code-block:: shell
tox -e refresh_examples -- --target-dir ~/.ansible/collections/ansible_collections/vmware/vmware_rest
Testing with ansible-test
=========================

All the modules are covered by a functional test. The tests are located in the :file:`tests/integration/targets/`.

To run the tests, you will need a vcenter instance and an ESXi.

black code formatter
~~~~~~~~~~~~~~~~~~~~

We follow the coding style of `Black <https://github.com/psf/black>`.
You can run the code formatter with the following command.


.. code-block:: shell
tox -e black
sanity tests
~~~~~~~~~~~~

Here we use Python 3.8, the minimal version is 3.6.

.. code-block:: shell
tox -e black
ansible-test sanity --debug --requirements --local --skip-test future-import-boilerplate --skip-test metaclass-boilerplate --python 3.8 -vvv
integration tests
~~~~~~~~~~~~~~~~~

These tests should be run against your test environment.

..warning:: The test suite will delete all the existing DC from your test environment.

First, prepare a configuration file, we call it :file:`/tmp/inventory-vmware_rest` in
this example:

.. code-block:: ini
[vmware_rest]
localhost ansible_connection=local ansible_python_interpreter=python
[vmware_rest:vars]
vcenter_hostname=vcenter.test
vcenter_username[email protected]
vcenter_password=kLRy|FXwZSHXW0w?Q:sO
esxi1_hostname=esxi1.test
esxi1_username=zuul
esxi1_password=f6QYNi65k05kv8m56
To run the tests, use the following command. You may want to adjust the Python version.

.. code-block:: shell
ansible-test network-integration --diff --no-temp-workdir --python 3.8 --inventory /tmp/inventory-vmware_rest zuul/

0 comments on commit c100514

Please sign in to comment.