summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Bogatov <KAction@debian.org>2018-12-24 15:17:35 +0000
committerDmitry Bogatov <KAction@debian.org>2018-12-24 15:17:35 +0000
commit17011597c4352141619a574b1682e4fc33c5c32e (patch)
treed28db609c12379970429a11aae208e2610a318cd
parent2107ccf8fa0d2e1f1d875ad0276f5310b71e1724 (diff)
parent45ce0a1d2f3f516aa639177c3d46ad373c4871f3 (diff)
Update upstream source from tag 'upstream/4.10.5'
Update to upstream version '4.10.5' with Debian dir 7af1e32d2cb72f10a3ffa0ea775534fc34d673fd
-rwxr-xr-xcdist/conf/type/__consul_agent/manifest2
-rw-r--r--cdist/conf/type/__docker/man.rst5
-rwxr-xr-xcdist/conf/type/__docker/manifest18
-rw-r--r--cdist/conf/type/__docker/parameter/default/version1
-rw-r--r--cdist/conf/type/__docker/parameter/optional1
-rwxr-xr-xcdist/conf/type/__group/gencode-remote6
-rwxr-xr-xcdist/conf/type/__package_emerge/gencode-remote10
-rwxr-xr-xcdist/conf/type/__package_emerge_dependencies/gencode-remote3
-rwxr-xr-xcdist/conf/type/__package_luarocks/gencode-remote2
-rwxr-xr-xcdist/conf/type/__package_opkg/gencode-remote4
-rwxr-xr-xcdist/conf/type/__package_pacman/gencode-remote2
-rwxr-xr-xcdist/conf/type/__package_pip/gencode-remote2
-rwxr-xr-xcdist/conf/type/__package_pkg_freebsd/gencode-remote5
-rwxr-xr-xcdist/conf/type/__package_pkg_openbsd/explorer/pkg_state49
-rwxr-xr-xcdist/conf/type/__package_pkg_openbsd/explorer/pkg_version32
-rwxr-xr-xcdist/conf/type/__package_pkg_openbsd/gencode-remote158
-rwxr-xr-xcdist/conf/type/__package_pkgng_freebsd/gencode-remote3
-rwxr-xr-xcdist/conf/type/__package_rubygem/gencode-remote2
-rwxr-xr-xcdist/conf/type/__package_yum/gencode-remote2
-rwxr-xr-xcdist/conf/type/__package_zypper/gencode-remote3
-rw-r--r--cdist/conf/type/__ping/gencode-remote12
-rw-r--r--cdist/conf/type/__ping/man.rst43
-rw-r--r--cdist/conf/type/__ping/singleton0
-rwxr-xr-xcdist/conf/type/__postgres_role/gencode-remote4
-rwxr-xr-xcdist/conf/type/__sysctl/gencode-remote27
-rwxr-xr-xcdist/conf/type/__sysctl/manifest8
-rw-r--r--docs/changelog11
-rw-r--r--docs/web/cdist.mdwn8
28 files changed, 279 insertions, 144 deletions
diff --git a/cdist/conf/type/__consul_agent/manifest b/cdist/conf/type/__consul_agent/manifest
index 3951f72..c48bfe8 100755
--- a/cdist/conf/type/__consul_agent/manifest
+++ b/cdist/conf/type/__consul_agent/manifest
@@ -206,7 +206,7 @@ case "$os" in
[567])
init_sysvinit debian
;;
- 8)
+ [89])
init_systemd
;;
*)
diff --git a/cdist/conf/type/__docker/man.rst b/cdist/conf/type/__docker/man.rst
index 5cb28ee..718543a 100644
--- a/cdist/conf/type/__docker/man.rst
+++ b/cdist/conf/type/__docker/man.rst
@@ -20,6 +20,9 @@ OPTIONAL PARAMETERS
-------------------
state
'present' or 'absent', defaults to 'present'
+version
+ The specific version to install. Defaults to the special value 'latest',
+ meaning the version the package manager will install by default.
BOOLEAN PARAMETERS
@@ -38,6 +41,8 @@ EXAMPLES
# Remove docker
__docker --state absent
+ # Install specific version
+ __docker --state present --version 18.03.0.ce
AUTHORS
-------
diff --git a/cdist/conf/type/__docker/manifest b/cdist/conf/type/__docker/manifest
index 8f26fee..04a9ff2 100755
--- a/cdist/conf/type/__docker/manifest
+++ b/cdist/conf/type/__docker/manifest
@@ -21,6 +21,7 @@
os=$(cat "$__global/explorer/os")
state=$(cat "$__object/parameter/state")
+version=$(cat "$__object/parameter/version")
case "$os" in
centos)
@@ -33,7 +34,11 @@ case "$os" in
--gpgcheck 1 \
--gpgkey 'https://download.docker.com/linux/centos/gpg' \
--state "${state}"
- require="__yum_repo/docker-ce-stable" __package docker-ce --state "${state}"
+ if [ "$version" != "latest" ]; then
+ require="__yum_repo/docker-ce-stable" __package docker-ce --version "${version}" --state "${state}"
+ else
+ require="__yum_repo/docker-ce-stable" __package docker-ce --state "${state}"
+ fi
else
echo "CentOS version 7 is required!" >&2
exit 1
@@ -47,14 +52,17 @@ case "$os" in
fi
__apt_key_uri docker --name "Docker Release (CE deb) <docker@docker.com>" \
--uri "https://download.docker.com/linux/${os}/gpg" --state "${state}"
- export CDIST_ORDER_DEPENDENCY=on
- __apt_source docker \
+
+ require="__apt_key_uri/docker" __apt_source docker \
--uri "https://download.docker.com/linux/${os}" \
--distribution "$(cat "$__global/explorer/lsb_codename")" \
--state "${state}" \
--component "stable"
- __package docker-ce --state "${state}"
- unset CDIST_ORDER_DEPENDENCY
+ if [ "$version" != "latest" ]; then
+ require="__apt_source/docker" __package docker-ce --version "${version}" --state "${state}"
+ else
+ require="__apt_source/docker" __package docker-ce --state "${state}"
+ fi
;;
*)
echo "Your operating system ($os) is currently not supported by this type (${__type##*/})." >&2
diff --git a/cdist/conf/type/__docker/parameter/default/version b/cdist/conf/type/__docker/parameter/default/version
new file mode 100644
index 0000000..a0f9a4b
--- /dev/null
+++ b/cdist/conf/type/__docker/parameter/default/version
@@ -0,0 +1 @@
+latest
diff --git a/cdist/conf/type/__docker/parameter/optional b/cdist/conf/type/__docker/parameter/optional
index ff72b5c..4d595ed 100644
--- a/cdist/conf/type/__docker/parameter/optional
+++ b/cdist/conf/type/__docker/parameter/optional
@@ -1 +1,2 @@
state
+version
diff --git a/cdist/conf/type/__group/gencode-remote b/cdist/conf/type/__group/gencode-remote
index 822619d..6091c54 100755
--- a/cdist/conf/type/__group/gencode-remote
+++ b/cdist/conf/type/__group/gencode-remote
@@ -30,9 +30,9 @@ state="$(cat "$__object/parameter/state")"
# Use short option names for portability
shorten_property() {
case "$1" in
- gid) echo -- "-g";;
- password) echo -- "-p";;
- system) echo -- "-r";;
+ gid) echo " -g";;
+ password) echo " -p";;
+ system) echo " -r";;
esac
}
diff --git a/cdist/conf/type/__package_emerge/gencode-remote b/cdist/conf/type/__package_emerge/gencode-remote
index 48462bd..b144ede 100755
--- a/cdist/conf/type/__package_emerge/gencode-remote
+++ b/cdist/conf/type/__package_emerge/gencode-remote
@@ -39,12 +39,12 @@ pkg_version="$(cat "$__object/explorer/pkg_version")"
if [ -z "$pkg_version" ]; then
state_is="absent"
elif [ -z "$version" ] && [ "$(echo "$pkg_version" | wc -l)" -gt 1 ]; then
- echo "Package name is not unique! The following packages are installed:"
- echo "$pkg_version"
+ echo "Package name is not unique! The following packages are installed:" >&2
+ echo "$pkg_version" >&2
exit 1
elif [ -n "$version" ] && [ "$(echo "$pkg_version" | cut -d " " -f 1 | sort | uniq | wc -l)" -gt 1 ]; then
- echo "Package name is not unique! The following packages are installed:"
- echo "$pkg_version"
+ echo "Package name is not unique! The following packages are installed:" >&2
+ echo "$pkg_version" >&2
exit 1
else
state_is="present"
@@ -64,9 +64,11 @@ fi
case "$state_should" in
present)
echo "emerge '$name' &>/dev/null || exit 1"
+ echo "installed" >> "$__messages_out"
;;
absent)
echo "emerge -C '$name' &>/dev/null || exit 1"
+ echo "removed" >> "$__messages_out"
;;
*)
echo "Unknown state: $state_should" >&2
diff --git a/cdist/conf/type/__package_emerge_dependencies/gencode-remote b/cdist/conf/type/__package_emerge_dependencies/gencode-remote
index face898..f3e6f76 100755
--- a/cdist/conf/type/__package_emerge_dependencies/gencode-remote
+++ b/cdist/conf/type/__package_emerge_dependencies/gencode-remote
@@ -6,10 +6,11 @@ flaggie_installed="$(cat "$__object/explorer/flaggie_installed")"
if [ "${gentoolkit_installed}" != "true" ]; then
# emerge app-portage/gentoolkit
echo "emerge app-portage/gentoolkit &> /dev/null || exit 1"
+ echo "installed app-portage/gentoolkit" >> "$__messages_out"
fi
if [ "${flaggie_installed}" != "true" ]; then
# emerge app-portage/flaggie
echo "emerge app-portage/flaggie &> /dev/null || exit 1"
+ echo "installed app-portage/flaggie" >> "$__messages_out"
fi
-
diff --git a/cdist/conf/type/__package_luarocks/gencode-remote b/cdist/conf/type/__package_luarocks/gencode-remote
index 60b9bfe..d83b3c3 100755
--- a/cdist/conf/type/__package_luarocks/gencode-remote
+++ b/cdist/conf/type/__package_luarocks/gencode-remote
@@ -43,9 +43,11 @@ fi
case "$state_should" in
present)
echo "luarocks install '$name'"
+ echo "installed" >> "$__messages_out"
;;
absent)
echo "luarocks remove '$name'"
+ echo "removed" >> "$__messages_out"
;;
*)
echo "Unknown state: $state_should" >&2
diff --git a/cdist/conf/type/__package_opkg/gencode-remote b/cdist/conf/type/__package_opkg/gencode-remote
index e94ff38..269d5f4 100755
--- a/cdist/conf/type/__package_opkg/gencode-remote
+++ b/cdist/conf/type/__package_opkg/gencode-remote
@@ -43,12 +43,14 @@ esac
case "$state_should" in
present)
if [ "$present" = "notpresent" ]; then
- echo opkg --verbosity=0 update
+ echo "opkg --verbosity=0 update"
fi
echo "opkg --verbosity=0 install '$name'"
+ echo "installed" >> "$__messages_out"
;;
absent)
echo "opkg --verbosity=0 remove '$name'"
+ echo "removed" >> "$__messages_out"
;;
*)
echo "Unknown state: ${state_should}" >&2
diff --git a/cdist/conf/type/__package_pacman/gencode-remote b/cdist/conf/type/__package_pacman/gencode-remote
index 7ba8547..2e076ec 100755
--- a/cdist/conf/type/__package_pacman/gencode-remote
+++ b/cdist/conf/type/__package_pacman/gencode-remote
@@ -46,9 +46,11 @@ fi
case "$state_should" in
present)
echo "pacman --needed --noconfirm --noprogressbar -S '$name'"
+ echo "installed" >> "$__messages_out"
;;
absent)
echo "pacman --noconfirm --noprogressbar -R '$name'"
+ echo "removed" >> "$__messages_out"
;;
*)
echo "Unknown state: $state_should" >&2
diff --git a/cdist/conf/type/__package_pip/gencode-remote b/cdist/conf/type/__package_pip/gencode-remote
index 33556be..dcc4fdf 100755
--- a/cdist/conf/type/__package_pip/gencode-remote
+++ b/cdist/conf/type/__package_pip/gencode-remote
@@ -57,6 +57,7 @@ case "$state_should" in
else
echo $pip install -q "$name"
fi
+ echo "installed" >> "$__messages_out"
;;
absent)
if [ "$runas" ]
@@ -65,6 +66,7 @@ case "$state_should" in
else
echo $pip uninstall -q -y "$name"
fi
+ echo "removed" >> "$__messages_out"
;;
*)
echo "Unknown state: $state_should" >&2
diff --git a/cdist/conf/type/__package_pkg_freebsd/gencode-remote b/cdist/conf/type/__package_pkg_freebsd/gencode-remote
index fd02d93..3f88f6b 100755
--- a/cdist/conf/type/__package_pkg_freebsd/gencode-remote
+++ b/cdist/conf/type/__package_pkg_freebsd/gencode-remote
@@ -39,7 +39,7 @@ assert () # If condition false,
# shellcheck disable=SC2039
echo "File \"$0\", line $lineno, called by $(caller 0)"
exit $E_ASSERT_FAILED
- fi
+ fi
}
# Debug
@@ -89,6 +89,7 @@ if [ -n "$curr_version" ]; then # PKG *is* installed
cmd="${rm_cmd} ${name}-${curr_version}"
fi
execcmd "remove" "${cmd}"
+ echo "removed" >> "$__messages_out"
exit 0
else # Should be installed
if [ -n "$version" ]; then # Want a specific version
@@ -102,6 +103,7 @@ if [ -n "$curr_version" ]; then # PKG *is* installed
execcmd "remove" "${cmd}"
cmd="${add_cmd} -r ${name}-${version}"
execcmd "add" "${cmd}"
+ echo "installed" >> "$__messages_out"
fi
else # Don't care what version to use
exit 0
@@ -120,6 +122,7 @@ else # PKG *isn't* installed
cmd="${cmd}-${version}"
fi
execcmd "add" "${cmd}"
+ echo "installed" >> "$__messages_out"
exit 0
fi
fi
diff --git a/cdist/conf/type/__package_pkg_openbsd/explorer/pkg_state b/cdist/conf/type/__package_pkg_openbsd/explorer/pkg_state
new file mode 100755
index 0000000..9cd1778
--- /dev/null
+++ b/cdist/conf/type/__package_pkg_openbsd/explorer/pkg_state
@@ -0,0 +1,49 @@
+#!/bin/sh
+#
+# Copyright 2018, Takashi Yoshi <takashi@yoshi.email>
+#
+# 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 <http://www.gnu.org/licenses/>.
+#
+#
+# Retrieve the status of a package - parsed pkg_info output
+#
+
+if [ -f "${__object}/parameter/name" ]
+then
+ pkgid="$(cat "${__object}/parameter/name")"
+else
+ pkgid="${__object_id}"
+fi
+
+if [ -f "${__object}/parameter/version" ]
+then
+ pkgid="${pkgid}-$(cat "${__object}/parameter/version")"
+fi
+
+if [ -f "${__object}/parameter/flavor" ]
+then
+ # If a flavor but no version is given we need to add another -,
+ # otherwise pkg_info confuses the flavor with the version.
+ [ -f "${__object}/parameter/version" ] || pkgid="${pkgid}-"
+
+ pkgid="${pkgid}-$(cat "${__object}/parameter/flavor")"
+fi
+
+
+pkg_info -q -I "inst:${pkgid}" >/dev/null 2>&1 \
+ && echo 'present' || echo 'absent'
+
+exit 0
diff --git a/cdist/conf/type/__package_pkg_openbsd/explorer/pkg_version b/cdist/conf/type/__package_pkg_openbsd/explorer/pkg_version
deleted file mode 100755
index 212f0d9..0000000
--- a/cdist/conf/type/__package_pkg_openbsd/explorer/pkg_version
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/bin/sh
-#
-# 2011 Andi Brönnimann (andi-cdist at v-net.ch)
-# Copyright 2017, Philippe Gregoire <pg@pgregoire.xyz>
-#
-# 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 <http://www.gnu.org/licenses/>.
-#
-#
-# Retrieve the status of a package - parsed dpkg output
-#
-
-if [ -f "$__object/parameter/name" ]; then
- name="$(cat "$__object/parameter/name")"
-else
- name="$__object_id"
-fi
-
-#TODO: Is there a better way?
-pkg_info | grep "^$name-[0-9]" | sed 's|.*\(-[0-9][0-9.]*\).*|\1|' | sed 's/-//'
diff --git a/cdist/conf/type/__package_pkg_openbsd/gencode-remote b/cdist/conf/type/__package_pkg_openbsd/gencode-remote
index 61383ed..5a21ce1 100755
--- a/cdist/conf/type/__package_pkg_openbsd/gencode-remote
+++ b/cdist/conf/type/__package_pkg_openbsd/gencode-remote
@@ -2,6 +2,7 @@
#
# 2011 Andi Brönnimann (andi-cdist at v-net.ch)
# 2012 Nico Schottelius (nico-cdist at schottelius.org)
+# 2018 Takashi Yoshi <takashi@yoshi.email>
#
# This file is part of cdist.
#
@@ -22,105 +23,96 @@
# Manage packages with pkg on OpenBSD
#
-# Debug
-# exec >&2
-# set -x
+os_version=$(cat "${__global}/explorer/os_version")
+machine=$(cat "${__global}/explorer/machine")
-os_version="$(cat "$__global/explorer/os_version")"
-machine="$(cat "$__global/explorer/machine")"
-
-if [ -f "$__object/parameter/version" ]; then
- version="$(cat "$__object/parameter/version")"
+if [ -f "${__object}/parameter/version" ]; then
+ version=$(cat "${__object}/parameter/version")
fi
-if [ -f "$__object/parameter/flavor" ]; then
- flavor="$(cat "$__object/parameter/flavor")"
+if [ -f "${__object}/parameter/flavor" ]; then
+ flavor=$(cat "${__object}/parameter/flavor")
fi
-# do not show progress bar
-pkgopts="-x"
+# Do not show progress bar
+pkgopts='-x'
-if [ -f "$__object/parameter/name" ]; then
- name=$(cat "$__object/parameter/name")
-else
- name="$__object_id"
+name="${__object_id}"
+if [ -f "${__object}/parameter/name" ]; then
+ name=$(cat "${__object}/parameter/name")
fi
-if [ -n "$version" ] && [ -n "$flavor" ]; then
- pkgid="$name-$version-$flavor"
-elif [ -n "$version" ]; then
- pkgid="$name-$version"
-elif [ -n "$flavor" ]; then
- pkgid="$name--$flavor"
-elif [ -f "$__object/parameter/flavor" ]; then
- pkgid="$name--"
+if [ -n "${version}" ] && [ -n "${flavor}" ]; then
+ pkgid="${name}-${version}-${flavor}"
+elif [ -n "${version}" ]; then
+ pkgid="${name}-${version}"
+elif [ -f "${__object}/parameter/flavor" ]; then
+ pkgid="${name}--${flavor}"
else
- pkgid="$name"
+ pkgid="${name}"
fi
-state_should="$(cat "$__object/parameter/state")"
-
-pkg_version="$(cat "$__object/explorer/pkg_version")"
+state_should=$(cat "${__object}/parameter/state")
-if [ -f "$__object/parameter/pkg_path" ]; then
- pkg_path="$(cat "$__object/parameter/pkg_path")"
+if [ -f "${__object}/parameter/pkg_path" ]; then
+ pkg_path=$(cat "${__object}/parameter/pkg_path")
else
- has_installurl=$(cat "${__object}/explorer/has_installurl")
- if [ Xyes != X"${has_installurl}" ]; then
- # there is no default PKG_PATH, try to provide one
- pkg_path="ftp://ftp.openbsd.org/pub/OpenBSD/$os_version/packages/$machine/"
- fi
-fi
-
-if [ "$pkg_version" ]; then
- state_is="present"
-else
- state_is="absent"
+ has_installurl=$(cat "${__object}/explorer/has_installurl")
+ if [ 'yes' != "${has_installurl}" ]; then
+ # There is no default PKG_PATH, try to provide one
+ pkg_path="ftp://ftp.openbsd.org/pub/OpenBSD/${os_version}/packages/${machine}/"
+ fi
fi
-[ "$state_is" = "$state_should" ] && exit 0
-
-case "$state_should" in
- present)
- # use this because pkg_add doesn't properly handle errors
- cat << eof
-if [ X != X"${pkg_path}" ]; then
- PKG_PATH="${pkg_path}"; export PKG_PATH
-fi
-status=\$(pkg_add "$pkgopts" "$pkgid" 2>&1)
-pkg_info | grep "^${name}.*${version}.*${flavor}" > /dev/null 2>&1
-
-# We didn't find the package in the list of 'installed packages', so it failed
-# This is necessary because pkg_add doesn't return properly
-if [ \$? -ne 0 ]; then
- if [ -z "\${status}" ]; then
- status="Failed to add package, uncaught exception."
- fi
- echo "Error: \$status"
- exit 1
+state_is=$(cat "${__object}/explorer/pkg_state")
+[ "${state_is}" = "${state_should}" ] && exit 0
+
+case "${state_should}" in
+ present)
+ if [ -n "${pkg_path}" ]; then
+ echo "export PKG_PATH='${pkg_path}'"
+ fi
+
+ # Use this because pkg_add doesn't properly handle errors
+ cat <<EOF
+status=\$(pkg_add ${pkgopts} '${pkgid}' 2>&1 || true)
+
+if ! pkg_info -q -I 'inst:${pkgid}' | grep -q '^${name}-${version}.*${flavor}$' 2>/dev/null
+then
+ # We didn't find the package in the list of 'installed packages', so it failed.
+ # This is necessary because pkg_add doesn't return properly
+
+ if [ -z "\${status}" ]; then
+ status='Failed to add package, uncaught exception.'
+ fi
+ echo "Error: \${status}" >&2
+ exit 1
fi
-eof
- ;;
-
- absent)
- # use this because pkg_add doesn't properly handle errors
- cat << eof
-status=\$(pkg_delete "$pkgopts" "$pkgid")
-pkg_info | grep "^${name}.*${version}.*${flavor}" > /dev/null 2>&1
-
-# We found the package in the list of 'installed packages'
-# This would indicate that pkg_delete failed, send the output of pkg_delete
-if [ \$? -eq 0 ]; then
- if [ -z "\${status}" ]; then
- status="Failed to remove package, uncaught exception."
- fi
- echo "Error: \$status"
- exit 1
+EOF
+ echo 'installed' >> "${__messages_out}"
+ ;;
+
+ absent)
+ # Use this because pkg_delete doesn't properly handle errors
+ cat <<EOF
+status=\$(pkg_delete ${pkgopts} '${pkgid}' 2>&1 || true)
+
+if pkg_info -q -I 'inst:${pkgid}' | grep -q '^${name}-${version}.*${flavor}' 2>/dev/null
+then
+ # We found the package in the list of 'installed packages'.
+ # This would indicate that pkg_delete failed, send the output of pkg_delete
+
+ if [ -z "\${status}" ]; then
+ status='Failed to remove package, uncaught exception.'
+ fi
+ echo "Error: \${status}" >&2
+ exit 1
fi
-eof
- ;;
- *)
- echo "Unknown state: $state_should" >&2
+EOF
+ echo 'removed' >> "${__messages_out}"
+ ;;
+ *)
+ echo "Unknown state: ${state_should}" >&2
exit 1
- ;;
+ ;;
esac
diff --git a/cdist/conf/type/__package_pkgng_freebsd/gencode-remote b/cdist/conf/type/__package_pkgng_freebsd/gencode-remote
index b72544c..dd36efd 100755
--- a/cdist/conf/type/__package_pkgng_freebsd/gencode-remote
+++ b/cdist/conf/type/__package_pkgng_freebsd/gencode-remote
@@ -57,12 +57,15 @@ execcmd(){
case "$1" in
add)
_cmd="${add_cmd} $2"
+ echo "installed" >> "$__messages_out"
;;
rm)
_cmd="${rm_cmd} $2"
+ echo "removed" >> "$__messages_out"
;;
upg)
_cmd="${upg_cmd} $2"
+ echo "installed" >> "$__messages_out"
;;
*)
printf "Error. Don't understand command: %s" "$1" >&2
diff --git a/cdist/conf/type/__package_rubygem/gencode-remote b/cdist/conf/type/__package_rubygem/gencode-remote
index ee563ef..abb4065 100755
--- a/cdist/conf/type/__package_rubygem/gencode-remote
+++ b/cdist/conf/type/__package_rubygem/gencode-remote
@@ -40,9 +40,11 @@ fi
case "$state_should" in
present)
echo "gem install '$name' --no-ri --no-rdoc"
+ echo "installed" >> "$__messages_out"
;;
absent)
echo "gem uninstall '$name'"
+ echo "removed" >> "$__messages_out"
;;
*)
echo "Unknown state: $state_should" >&2
diff --git a/cdist/conf/type/__package_yum/gencode-remote b/cdist/conf/type/__package_yum/gencode-remote
index 9726582..b52953f 100755
--- a/cdist/conf/type/__package_yum/gencode-remote
+++ b/cdist/conf/type/__package_yum/gencode-remote
@@ -61,9 +61,11 @@ fi
case "$state_should" in
present)
echo "yum $opts install '$install_name'"
+ echo "installed" >> "$__messages_out"
;;
absent)
echo "yum $opts remove '$name'"
+ echo "removed" >> "$__messages_out"
;;
*)
echo "Unknown state: $state_should" >&2
diff --git a/cdist/conf/type/__package_zypper/gencode-remote b/cdist/conf/type/__package_zypper/gencode-remote
index 1f15c53..e45dd9f 100755
--- a/cdist/conf/type/__package_zypper/gencode-remote
+++ b/cdist/conf/type/__package_zypper/gencode-remote
@@ -62,14 +62,17 @@ case "$state_should" in
if [ -z "$version_should" ]; then
[ "$state_is" = "present" ] && exit 0 # if state is present, we dont need to do anything
echo "zypper $globalopts install --type '$ptype' --auto-agree-with-licenses '$name' >/dev/null"
+ echo "removed" >> "$__messages_out"
else
[ "$state_is" = "present" ] && [ "$version_should" = "$version_is" ] && exit 0 # if state is present and version is correct, we dont need to do anything
echo "zypper $globalopts install --oldpackage --type '$ptype' --auto-agree-with-licenses '$name' = '$version_should' >/dev/null"
+ echo "installed" >> "$__messages_out"
fi
;;
absent)
[ "$state_is" = "absent" ] && exit 0 # if state is absent, we dont need to do anything
echo "zypper $globalopts remove --type '$ptype' '$name' >/dev/null"
+ echo "removed" >> "$__messages_out"
;;
*)
echo "Unknown state: $state_should" >&2
diff --git a/cdist/conf/type/__ping/gencode-remote b/cdist/conf/type/__ping/gencode-remote
new file mode 100644
index 0000000..1341b95
--- /dev/null
+++ b/cdist/conf/type/__ping/gencode-remote
@@ -0,0 +1,12 @@
+#!/bin/sh -e
+#
+# Copyright (C) 2018 Olliver Schinagl <oliver@schinagl.nl>
+#
+# SPDX-License-Identifier: GPL-3.0+
+#
+
+set -eu
+
+echo "echo 'pong'"
+
+exit 0
diff --git a/cdist/conf/type/__ping/man.rst b/cdist/conf/type/__ping/man.rst
new file mode 100644
index 0000000..e08643d
--- /dev/null
+++ b/cdist/conf/type/__ping/man.rst
@@ -0,0 +1,43 @@
+cdist-type__ping(7)
+==================================
+
+NAME
+----
+cdist-type__ping - Try to connect to host and return 'pong' on success
+
+
+DESCRIPTION
+-----------
+A simple type which tries to connect to a remote host and runs a simple command
+to ensure everything is working.
+
+
+REQUIRED PARAMETERS
+-------------------
+None.
+
+
+OPTIONAL PARAMETERS
+-------------------
+None.
+
+
+EXAMPLES
+--------
+
+.. code-block:: sh
+
+ __ping
+
+
+AUTHORS
+-------
+Olliver Schinagl <oliver--@--schinagl.nl>
+
+
+COPYING
+-------
+Copyright \(C) 2018 Schinagl. 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.
diff --git a/cdist/conf/type/__ping/singleton b/cdist/conf/type/__ping/singleton
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/cdist/conf/type/__ping/singleton
diff --git a/cdist/conf/type/__postgres_role/gencode-remote b/cdist/conf/type/__postgres_role/gencode-remote
index f04b22e..30d0689 100755
--- a/cdist/conf/type/__postgres_role/gencode-remote
+++ b/cdist/conf/type/__postgres_role/gencode-remote
@@ -55,9 +55,9 @@ case "$state_should" in
[ -n "$password" ] && password="PASSWORD '$password'"
cmd="CREATE ROLE $name WITH $password $booleans"
- echo "su - '$postgres_user' -c \"psql postgres -c '$cmd'\""
+ echo "su - '$postgres_user' -c \"psql postgres -c \\\"$cmd\\\"\""
;;
absent)
- echo "su - '$postgres_user' -c \"dropuser '$name'\""
+ echo "su - '$postgres_user' -c \"dropuser \\\"$name\\\"\""
;;
esac
diff --git a/cdist/conf/type/__sysctl/gencode-remote b/cdist/conf/type/__sysctl/gencode-remote
index a7aedb8..711d54e 100755
--- a/cdist/conf/type/__sysctl/gencode-remote
+++ b/cdist/conf/type/__sysctl/gencode-remote
@@ -1,6 +1,7 @@
#!/bin/sh -e
#
# 2014 Steven Armstrong (steven-cdist at armstrong.cc)
+# 2018 Takashi Yoshi (takashi at yoshi.email)
#
# This file is part of cdist.
#
@@ -28,12 +29,26 @@ fi
os=$(cat "$__global/explorer/os")
case "$os" in
- redhat|centos|ubuntu|debian|devuan|archlinux|coreos)
- flag='-w'
- ;;
- frebsd)
- flag=''
- ;;
+ # Linux
+ redhat|centos|ubuntu|debian|devuan|archlinux|gentoo|coreos)
+ flag='-w'
+ ;;
+ # BusyBox
+ alpine|openwrt)
+ flag='-w'
+ ;;
+ macosx)
+ # NOTE: Older versions of Mac OS X require the -w option.
+ # Even though the flag is not mentioned in new man pages anymore,
+ # it still works.
+ flag='-w'
+ ;;
+ netbsd)
+ flag='-w'
+ ;;
+ freebsd|openbsd)
+ flag=''
+ ;;
esac
# set the current runtime value
diff --git a/cdist/conf/type/__sysctl/manifest b/cdist/conf/type/__sysctl/manifest
index 6e337cc..b4e2e90 100755
--- a/cdist/conf/type/__sysctl/manifest
+++ b/cdist/conf/type/__sysctl/manifest
@@ -1,6 +1,7 @@
#!/bin/sh -e
#
# 2014 Steven Armstrong (steven-cdist at armstrong.cc)
+# 2018 Takashi Yoshi (takashi at yoshi.email)
#
# This file is part of cdist.
#
@@ -22,7 +23,12 @@
os=$(cat "$__global/explorer/os")
case "$os" in
- redhat|centos|ubuntu|debian|devuan|archlinux|coreos|freebsd)
+ # Linux
+ redhat|centos|ubuntu|debian|devuan|archlinux|coreos)
+ :
+ ;;
+ # BSD
+ freebsd|macosx|netbsd|openbsd)
:
;;
*)
diff --git a/docs/changelog b/docs/changelog
index fd68bed..5dbf9bb 100644
--- a/docs/changelog
+++ b/docs/changelog
@@ -1,6 +1,17 @@
Changelog
---------
+4.10.5: 2018-12-21
+ * Type __group: Fix/remove '--' from echo command (Dimitrios Apostolou)
+ * New type: __ping (Olliver Schinagl)
+ * Type __postgres_role: Fix broken syntax (Nico Schottelius, Darko Poljak)
+ * Type __consul_agent: Add Debian 9 support (Jin-Guk Kwon)
+ * Documentation: Fix broken links (Rage <OxR463>)
+ * Type __docker: Add version parameter (Jonas Weber)
+ * Type __sysctl: Refactor for better OS support (Takashi Yoshi)
+ * Types __package_*: Add messaging upon installation/removal (Takashi Yoshi)
+ * Type __package_pkg_openbsd: Reworked (Takashi Yoshi)
+
4.10.4: 2018-11-03
* Core: Transfer all files of a directory at once instead of calling copy once per file (myeisha)
* Core: Add timestamp (optional) to log messages (Darko Poljak)
diff --git a/docs/web/cdist.mdwn b/docs/web/cdist.mdwn
index 74457fc..90af20c 100644
--- a/docs/web/cdist.mdwn
+++ b/docs/web/cdist.mdwn
@@ -6,10 +6,10 @@ cdist is a usable configuration management system.
It adheres to the KISS principle and
is being used in small up to enterprise grade environments.
cdist is an alternative to other configuration management systems like
-[bcfg2](http://trac.mcs.anl.gov/projects/bcfg2),
-[chef](http://wiki.opscode.com/display/chef/),
-[cfengine](http://www.cfengine.org/)
-and [puppet](http://www.puppetlabs.com/).
+[bcfg2](http://bcfg2.org/),
+[chef](https://www.chef.sh/),
+[cfengine](https://cfengine.com/)
+and [puppet](https://puppet.com/).
* [[Why should I use cdist?|why]]
* [[Documentation|documentation]]