From 5ed643e7c2bcf7844fa3f1123642004b42cebf65 Mon Sep 17 00:00:00 2001 From: Daniel Fancsali Date: Mon, 18 Jan 2021 18:52:34 +0000 Subject: [PATCH 1/4] New type: __nop --- cdist/conf/type/__nop/gencode-remote | 21 +++++++++++ cdist/conf/type/__nop/man.rst | 54 ++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100755 cdist/conf/type/__nop/gencode-remote create mode 100644 cdist/conf/type/__nop/man.rst diff --git a/cdist/conf/type/__nop/gencode-remote b/cdist/conf/type/__nop/gencode-remote new file mode 100755 index 00000000..5f909670 --- /dev/null +++ b/cdist/conf/type/__nop/gencode-remote @@ -0,0 +1,21 @@ +#!/bin/sh -e +# +# 2021 Daniel Fancsali (fancsali@gmail.com) +# +# This file is part of cdist. +# +# cdist is free software: 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. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see . +# + +echo "All your base are belong to us." >&2 diff --git a/cdist/conf/type/__nop/man.rst b/cdist/conf/type/__nop/man.rst new file mode 100644 index 00000000..28f783e6 --- /dev/null +++ b/cdist/conf/type/__nop/man.rst @@ -0,0 +1,54 @@ +cdist-type__nop(7) +================== + +NAME +---- +cdist-type__nop - Do nothing. + + +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. + +The only thing that one needs to specify is some kind of object name, which will be simply ignored. + +It is advisible, though, to provide a name based on the parent object's id, so to make this call unique. + +REQUIRED PARAMETERS +------------------- +None. + + +OPTIONAL PARAMETERS +------------------- +None. + + +BOOLEAN PARAMETERS +------------------ +None. + + +EXAMPLES +-------- + +.. code-block:: sh + + require="__othertype/foo" __nop $__object_id # Use parent object's id to make the name unique + + +SEE ALSO +-------- +*Nothing to see here...* + +AUTHORS +------- +Daniel Fancsali + + +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. From 4c81808496051ade7b1fbffbafff862e12df2e89 Mon Sep 17 00:00:00 2001 From: fancsali Date: Thu, 3 Jun 2021 13:53:16 +0200 Subject: [PATCH 2/4] Update documentation to explain rationale --- cdist/conf/type/__nop/man.rst | 44 ++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/cdist/conf/type/__nop/man.rst b/cdist/conf/type/__nop/man.rst index 28f783e6..b4c99260 100644 --- a/cdist/conf/type/__nop/man.rst +++ b/cdist/conf/type/__nop/man.rst @@ -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 ------- From 5a3e3d870c46cc8bfc9acce1909dbe2f66d7294f Mon Sep 17 00:00:00 2001 From: Daniel Fancsali Date: Fri, 11 Jun 2021 16:10:53 +0100 Subject: [PATCH 3/4] Use empty manifest instead of useless gencode-remote --- cdist/conf/type/__nop/{gencode-remote => manifest} | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) rename cdist/conf/type/__nop/{gencode-remote => manifest} (94%) mode change 100755 => 100644 diff --git a/cdist/conf/type/__nop/gencode-remote b/cdist/conf/type/__nop/manifest old mode 100755 new mode 100644 similarity index 94% rename from cdist/conf/type/__nop/gencode-remote rename to cdist/conf/type/__nop/manifest index 5f909670..cc241932 --- a/cdist/conf/type/__nop/gencode-remote +++ b/cdist/conf/type/__nop/manifest @@ -18,4 +18,5 @@ # along with cdist. If not, see . # -echo "All your base are belong to us." >&2 + +## INTENTIONALLY LEFT BLANK! ## From ca1be26f356ba6d7c536a7b4862b0314c0c24301 Mon Sep 17 00:00:00 2001 From: Daniel Fancsali Date: Fri, 11 Jun 2021 16:14:03 +0100 Subject: [PATCH 4/4] Remove even the empty manifest --- cdist/conf/type/__nop/manifest | 22 ---------------------- 1 file changed, 22 deletions(-) delete mode 100644 cdist/conf/type/__nop/manifest diff --git a/cdist/conf/type/__nop/manifest b/cdist/conf/type/__nop/manifest deleted file mode 100644 index cc241932..00000000 --- a/cdist/conf/type/__nop/manifest +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh -e -# -# 2021 Daniel Fancsali (fancsali@gmail.com) -# -# This file is part of cdist. -# -# cdist is free software: 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. -# -# cdist is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with cdist. If not, see . -# - - -## INTENTIONALLY LEFT BLANK! ##