Merge branch 'xymon_config-excludes' into 'master'

add parameters for ownership and generic rsync-options (__xymon_config)

See merge request ungleich-public/cdist!810
This commit is contained in:
poljakowski 2019-11-20 20:57:31 +01:00
commit 37ee988d1f
4 changed files with 45 additions and 2 deletions

View file

@ -23,6 +23,21 @@ confdir
deployed. deployed.
OPTIONAL PARAMETERS
-------------------
owner
passed as-is as `--owner` to `__rsync`
group
passed as-is as `--group` to `__rsync`
OPTIONAL MULTIPLE PARAMETERS
----------------------------
rsync-opts
identical to __rsync type, only `--`-options are supported
REQUIRED FILES REQUIRED FILES
-------------- --------------
The directory specified by `confdir` has to contain a valid xymon-configuration The directory specified by `confdir` has to contain a valid xymon-configuration
@ -39,10 +54,16 @@ EXAMPLES
# this will replace /etc/xymon/ on the target host with # this will replace /etc/xymon/ on the target host with
# the contents from __xymon_config/files/xymon.example.com/ # the contents from __xymon_config/files/xymon.example.com/
## the same but set ownership to `xymon:xymon` and exclude
## the `netrc`-file:
__xymon_config --confdir=xymon.example.com \
--owner xymon --group xymon \
--rsync-opts "exclude=netrc"
SEE ALSO SEE ALSO
-------- --------
:strong:`cdist__xymon_server`\ (7), :strong:`xymon`\ (7) :strong:`cdist__xymon_server`\ (7), :strong:`cdist__rsync`\ (7), :strong:`xymon`\ (7)
AUTHORS AUTHORS
------- -------

View file

@ -18,7 +18,26 @@
# along with cdist. If not, see <http://www.gnu.org/licenses/>. # along with cdist. If not, see <http://www.gnu.org/licenses/>.
confdir=$(cat "$__object/parameter/confdir") confdir=$(cat "$__object/parameter/confdir")
set --
if [ -f "$__object/parameter/owner" ]; then
owner=$(cat "$__object/parameter/owner")
set -- "$@" "--owner $owner"
fi
if [ -f "$__object/parameter/group" ]; then
group=$(cat "$__object/parameter/group")
set -- "$@" "--group $group"
fi
## pass `--rsync-opts` as-is to `__rsync`:
if [ -f "$__object/parameter/rsync-opts" ]; then
while read -r opts; do
# shellcheck disable=SC2089
set -- "$@" "--rsync-opts '$opts'"
done < "$__object/parameter/rsync-opts"
fi
# shellcheck disable=SC2068,SC2090
__rsync /etc/xymon/ \ __rsync /etc/xymon/ \
--source "$__type/files/$confdir/" \ --source "$__type/files/$confdir/" \
--rsync-opts "delete" --rsync-opts "delete" \
$@

View file

@ -0,0 +1,2 @@
owner
group

View file

@ -0,0 +1 @@
rsync-opts