From 3167ececc62dbdaf06ca8e8a71cd84743cab0c91 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Wed, 5 Dec 2012 23:16:03 +0100 Subject: [PATCH] add owner/group support to __git Signed-off-by: Nico Schottelius --- cdist/conf/type/__git/manifest | 21 ++++++++++++++++++--- cdist/conf/type/__git/parameter/optional | 2 ++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/cdist/conf/type/__git/manifest b/cdist/conf/type/__git/manifest index 866515d7..e8c9b233 100644 --- a/cdist/conf/type/__git/manifest +++ b/cdist/conf/type/__git/manifest @@ -26,7 +26,22 @@ __package git --state present state_should=present [ -f "$__object/parameter/state" ] && state_should="$(cat "$__object/parameter/state")" +[ -f "$__object/parameter/owner" ] && dirparams="$dirparams --owner $(cat "$__object/parameter/owner")" +[ -f "$__object/parameter/group" ] && dirparams="$dirparams --group $(cat "$__object/parameter/group")" + # Let __directory handle removal of git repos -if [ "$state_should" = absent ]; then - __directory "$__object_id" --state absent -fi + +case "$state_should" in + present) + __directory "$__object_id" --state present $dirparams --recursive + ;; + + absent) + __directory "$__object_id" --state absent + ;; + + *) + echo "Unknown state: $state_should" >&2 + exit 1 + ;; +esac diff --git a/cdist/conf/type/__git/parameter/optional b/cdist/conf/type/__git/parameter/optional index 671134d6..d9684aaa 100644 --- a/cdist/conf/type/__git/parameter/optional +++ b/cdist/conf/type/__git/parameter/optional @@ -1,2 +1,4 @@ state branch +group +owner