Update documentation to explain rationale

This commit is contained in:
fancsali 2021-06-03 13:53:16 +02:00
parent 5ed643e7c2
commit 4c81808496
1 changed files with 25 additions and 19 deletions

View File

@ -3,43 +3,49 @@ cdist-type__nop(7)
NAME
----
cdist-type__nop - Do nothing.
cdist-type__nop - Do nothing, but allow dependencies to be specified.
DESCRIPTION
-----------
This type will literally do nothing; it's sole purpose is to provide an 'anchor point' in case one would have an empty manifest, but still needs to specify some dependencies.
If one has a type without any logic in the ``manifest`` (i.e. only some ``gencode-*`` logic), that depends on some other type, there are two ways make sure the dependencies taken into consideration:
The only thing that one needs to specify is some kind of object name, which will be simply ignored.
- Either remember to specify them "externally" *every time*, wherever and whenever those types are used
- Include a ``manifest`` in the *dependent* type, that does something useless (or even nothing)
It is advisible, though, to provide a name based on the parent object's id, so to make this call unique.
This type provides a convenient solution for the latter one. It is guaranteed to have no effect on the target host, but it provides an 'anchor point' for type-writers to include in an otherwise empty ``manifest``.
REQUIRED PARAMETERS
-------------------
PARAMETERS
----------
None.
OPTIONAL PARAMETERS
-------------------
None.
BOOLEAN PARAMETERS
------------------
None.
The ``$__object_id`` is required though, so the type can be used several times.
EXAMPLES
--------
Let's assume type ``__eggs`` depends on type ``__spam``, but has nothing in it's ``manifest``. In the simplest case, it's manifest can contain this:
.. code-block:: sh
__spam
require="__othertype/foo" __nop $__object_id # Use parent object's id to make the name unique
If, ``__spam`` has parameters, however, one would resort to this at the place of use:
.. code-block:: sh
__spam --foo bar
require="__spam" __ham --baz
SEE ALSO
--------
*Nothing to see here...*
Or by using the ``__nop`` type, simply do away with the ``require``, and update ``__ham/manifest`` to specify the dependency:
.. code-block:: sh
require="__spam" __nop $__object_id
In this case, when the type is used, the depencency is automatic, and one could simply write:
.. code-block:: sh
__spam --foo bar
__ham --baz
AUTHORS
-------