mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 12:50:22 -07:00
Add test plugin which allows to query whether a module or action plugin is available (#3628)
* Add test which allows to query whether an action is available. * Add documentation. * Fix FreeBSD / macOS compatibility. * Rename an_action -> a_module. * Forgot one place.
This commit is contained in:
parent
9eb638f651
commit
c69810bf04
11 changed files with 183 additions and 0 deletions
|
@ -3,3 +3,4 @@ sections:
|
|||
- title: Guides
|
||||
toctree:
|
||||
- filter_guide
|
||||
- test_guide
|
||||
|
|
28
docs/docsite/rst/test_guide.rst
Normal file
28
docs/docsite/rst/test_guide.rst
Normal file
|
@ -0,0 +1,28 @@
|
|||
.. _ansible_collections.community.general.docsite.test_guide:
|
||||
|
||||
community.general Test (Plugin) Guide
|
||||
=====================================
|
||||
|
||||
The :ref:`community.general collection <plugins_in_community.general>` offers currently one test plugin.
|
||||
|
||||
.. contents:: Topics
|
||||
|
||||
Feature Tests
|
||||
-------------
|
||||
|
||||
The ``a_module`` test allows to check whether a given string refers to an existing module or action plugin. This can be useful in roles, which can use this to ensure that required modules are present ahead of time.
|
||||
|
||||
.. code-block:: yaml+jinja
|
||||
|
||||
- name: Make sure that community.aws.route53 is available
|
||||
assert:
|
||||
that:
|
||||
- >
|
||||
'community.aws.route53' is community.general.a_module
|
||||
|
||||
- name: Make sure that community.general.does_not_exist is not a module or action plugin
|
||||
assert:
|
||||
that:
|
||||
- "'community.general.does_not_exist' is not community.general.a_module"
|
||||
|
||||
.. versionadded:: 4.0.0
|
Loading…
Add table
Add a link
Reference in a new issue