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

This commit is contained in:
tom 2019-11-20 15:49:25 +01:00
parent 0bc00477ae
commit 552860b9cd
4 changed files with 45 additions and 2 deletions

View file

@ -23,6 +23,21 @@ confdir
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
--------------
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
# 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
--------
:strong:`cdist__xymon_server`\ (7), :strong:`xymon`\ (7)
:strong:`cdist__xymon_server`\ (7), :strong:`cdist__rsync`\ (7), :strong:`xymon`\ (7)
AUTHORS
-------

View file

@ -18,7 +18,26 @@
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
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/ \
--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