Merge branch 'nop-type' into 'master'

New type: __nop

See merge request ungleich-public/cdist!996
This commit is contained in:
fancsali 2021-11-04 00:16:15 +01:00
commit 0f94c8af73
1 changed files with 60 additions and 0 deletions

View File

@ -0,0 +1,60 @@
cdist-type__nop(7)
==================
NAME
----
cdist-type__nop - Do nothing, but allow dependencies to be specified.
DESCRIPTION
-----------
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:
- 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)
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``.
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
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
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
-------
Daniel Fancsali <fancsali@gmail.com>
COPYING
-------
Copyright \(C) 2021 Daniel Fancsali. You can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.