From 479d57450bdd9cf7030707fca704b17a206abe87 Mon Sep 17 00:00:00 2001 From: Daniel Tschada Date: Tue, 3 Dec 2019 19:13:39 +0100 Subject: [PATCH] add new type __podman_compose --- .../conf/type/__podman_compose/gencode-remote | 24 ++++++++ cdist/conf/type/__podman_compose/man.rst | 61 +++++++++++++++++++ cdist/conf/type/__podman_compose/manifest | 50 +++++++++++++++ .../parameter/default/install | 1 + .../__podman_compose/parameter/default/state | 1 + .../__podman_compose/parameter/default/user | 1 + .../type/__podman_compose/parameter/optional | 4 ++ .../type/__podman_compose/parameter/required | 1 + cdist/conf/type/__podman_compose/singleton | 0 9 files changed, 143 insertions(+) create mode 100644 cdist/conf/type/__podman_compose/gencode-remote create mode 100644 cdist/conf/type/__podman_compose/man.rst create mode 100755 cdist/conf/type/__podman_compose/manifest create mode 100644 cdist/conf/type/__podman_compose/parameter/default/install create mode 100644 cdist/conf/type/__podman_compose/parameter/default/state create mode 100644 cdist/conf/type/__podman_compose/parameter/default/user create mode 100644 cdist/conf/type/__podman_compose/parameter/optional create mode 100644 cdist/conf/type/__podman_compose/parameter/required create mode 100644 cdist/conf/type/__podman_compose/singleton diff --git a/cdist/conf/type/__podman_compose/gencode-remote b/cdist/conf/type/__podman_compose/gencode-remote new file mode 100644 index 00000000..0f5cf9db --- /dev/null +++ b/cdist/conf/type/__podman_compose/gencode-remote @@ -0,0 +1,24 @@ +#!/bin/sh -e +# +# 2019 Daniel Tschada +# +# 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 . +# + +install="$(cat "$__object/parameter/install")" +state="$(cat "$__object/parameter/state")" +user="$(cat "$__object/parameter/user")" +version="$(cat "$__object/parameter/version")" \ No newline at end of file diff --git a/cdist/conf/type/__podman_compose/man.rst b/cdist/conf/type/__podman_compose/man.rst new file mode 100644 index 00000000..fa98f443 --- /dev/null +++ b/cdist/conf/type/__podman_compose/man.rst @@ -0,0 +1,61 @@ +cdist-type__podman_compose(7) +============================= + +NAME +---- +cdist-type__podman_compose - install podman-compose + + +DESCRIPTION +----------- +Installs podman-compose package. +State 'absent' will not remove podman binary itself, +only podman-compose binary will be removed + + +REQUIRED PARAMETERS +------------------- +install + defaults to 'pip' + + +OPTIONAL PARAMETERS +------------------- +state + 'present' or 'absent', defaults to 'present' +user + the user who owns the file, defaults to 'root' + + +BOOLEAN PARAMETERS +------------------ +None. + + +EXAMPLES +-------- + +.. code-block:: sh + + # Install podman-compose + __podman_compose + + # Install latest version via pip + __podman_compose --state present --install pip + + # Install latest version via pip and change user + __podman_compose --state present --install pip --user root + + # Remove podman-compose + __podman_compose --state absent + + +AUTHORS +------- +Daniel Tschada + + +COPYING +------- +Copyright \(C) 2019 Daniel Tschada. Free use of this software is +granted under the terms of the GNU General Public License version 3 or later (GPLv3+). diff --git a/cdist/conf/type/__podman_compose/manifest b/cdist/conf/type/__podman_compose/manifest new file mode 100755 index 00000000..2b06068d --- /dev/null +++ b/cdist/conf/type/__podman_compose/manifest @@ -0,0 +1,50 @@ +#!/bin/sh -e +# +# 2019 Daniel Tschada +# +# 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 . +# + +# shellcheck disable=SC2154 +# shellcheck disable=SC2034 +install="$(cat "$__object/parameter/install")" +state="$(cat "$__object/parameter/state")" +user="$(cat "$__object/parameter/user")" +version="$(cat "$__object/parameter/version")" + +# install it with pip +if [ "${install}" = "pip" ]; then + + if [ "${state}" = "present" ]; then + __package_pip podman-compose --state present --pip /usr/local/bin/podman-compose --runas "${user}" + elif [ "${state}" = "absent" ]; then + __package_pip podman-compose --state absent + else + if [ "${state}" != "present" ] -a [ "${state}" != "absent" ]; then + echo "Unknown state: ${state}" >&2 + exit 1 + else + echo "Unknown user: ${user}" >&2 + exit 1 + fi + fi + +else + + echo "Unknown user: ${install}" >&2 + exit 1 + +fi \ No newline at end of file diff --git a/cdist/conf/type/__podman_compose/parameter/default/install b/cdist/conf/type/__podman_compose/parameter/default/install new file mode 100644 index 00000000..a1b589e3 --- /dev/null +++ b/cdist/conf/type/__podman_compose/parameter/default/install @@ -0,0 +1 @@ +pip diff --git a/cdist/conf/type/__podman_compose/parameter/default/state b/cdist/conf/type/__podman_compose/parameter/default/state new file mode 100644 index 00000000..e7f6134f --- /dev/null +++ b/cdist/conf/type/__podman_compose/parameter/default/state @@ -0,0 +1 @@ +present diff --git a/cdist/conf/type/__podman_compose/parameter/default/user b/cdist/conf/type/__podman_compose/parameter/default/user new file mode 100644 index 00000000..d8649da3 --- /dev/null +++ b/cdist/conf/type/__podman_compose/parameter/default/user @@ -0,0 +1 @@ +root diff --git a/cdist/conf/type/__podman_compose/parameter/optional b/cdist/conf/type/__podman_compose/parameter/optional new file mode 100644 index 00000000..92913e56 --- /dev/null +++ b/cdist/conf/type/__podman_compose/parameter/optional @@ -0,0 +1,4 @@ +install +state +user +version diff --git a/cdist/conf/type/__podman_compose/parameter/required b/cdist/conf/type/__podman_compose/parameter/required new file mode 100644 index 00000000..7c32f559 --- /dev/null +++ b/cdist/conf/type/__podman_compose/parameter/required @@ -0,0 +1 @@ +install diff --git a/cdist/conf/type/__podman_compose/singleton b/cdist/conf/type/__podman_compose/singleton new file mode 100644 index 00000000..e69de29b