From 4294ff55e16ae8aba978721f8077605c6157eaf1 Mon Sep 17 00:00:00 2001 From: Dennis Camera Date: Mon, 9 Sep 2019 16:12:16 +0200 Subject: [PATCH 1/2] [type/__git] Add --recursive parameter --- cdist/conf/type/__git/gencode-remote | 32 ++++++++++++------------- cdist/conf/type/__git/man.rst | 2 ++ cdist/conf/type/__git/parameter/boolean | 1 + 3 files changed, 19 insertions(+), 16 deletions(-) create mode 100644 cdist/conf/type/__git/parameter/boolean diff --git a/cdist/conf/type/__git/gencode-remote b/cdist/conf/type/__git/gencode-remote index 5a9e23fc..3ba21add 100755 --- a/cdist/conf/type/__git/gencode-remote +++ b/cdist/conf/type/__git/gencode-remote @@ -19,32 +19,31 @@ # # -state_is="$(cat "$__object/explorer/state")" -owner_is="$(cat "$__object/explorer/owner")" -group_is="$(cat "$__object/explorer/group")" +state_is=$(cat "$__object/explorer/state") +owner_is=$(cat "$__object/explorer/owner") +group_is=$(cat "$__object/explorer/group") -state_should="$(cat "$__object/parameter/state")" +state_should=$(cat "$__object/parameter/state") -branch="$(cat "$__object/parameter/branch")" +branch=$(cat "$__object/parameter/branch") -source="$(cat "$__object/parameter/source")" +source=$(cat "$__object/parameter/source") destination="/$__object_id" -owner="$(cat "$__object/parameter/owner")" -group="$(cat "$__object/parameter/group")" -mode="$(cat "$__object/parameter/mode")" +owner=$(cat "$__object/parameter/owner") +group=$(cat "$__object/parameter/group") +mode=$(cat "$__object/parameter/mode") -[ "$state_should" = "$state_is" ] && \ -[ "$owner" = "$owner_is" ] && \ -[ "$group" = "$group_is" ] && \ -[ -n "$mode" ] && exit 0 +[ "$state_should" = "$state_is" ] \ + && [ "$owner" = "$owner_is" ] \ + && [ "$group" = "$group_is" ] \ + && [ -n "$mode" ] && exit 0 case $state_should in present) - if [ "$state_should" != "$state_is" ]; then - echo git clone --quiet --branch "$branch" "$source" "$destination" + echo git clone --quiet $([ -f "$__object/parameter/recursive" ] && echo '--recursive') --branch "$branch" "$source" "$destination" fi if { [ -n "$owner" ] && [ "$owner_is" != "$owner" ]; } || \ { [ -n "$group" ] && [ "$group_is" != "$group" ]; }; then @@ -54,8 +53,9 @@ case $state_should in echo chmod -R "$mode" "$destination" fi ;; - # Handled in manifest + absent) + # Handled in manifest ;; *) diff --git a/cdist/conf/type/__git/man.rst b/cdist/conf/type/__git/man.rst index 130925c8..e4c06c99 100644 --- a/cdist/conf/type/__git/man.rst +++ b/cdist/conf/type/__git/man.rst @@ -35,6 +35,8 @@ mode owner User to chown to. +recursive + Recursive clone... EXAMPLES -------- diff --git a/cdist/conf/type/__git/parameter/boolean b/cdist/conf/type/__git/parameter/boolean new file mode 100644 index 00000000..a633e659 --- /dev/null +++ b/cdist/conf/type/__git/parameter/boolean @@ -0,0 +1 @@ +recursive From 5c8e31b2ef85ccc740a75696675ac032cd33c199 Mon Sep 17 00:00:00 2001 From: Dennis Camera Date: Mon, 30 Sep 2019 13:22:55 +0200 Subject: [PATCH 2/2] [type/__git] Improve documentation of --recursive option --- cdist/conf/type/__git/man.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cdist/conf/type/__git/man.rst b/cdist/conf/type/__git/man.rst index e4c06c99..144eadda 100644 --- a/cdist/conf/type/__git/man.rst +++ b/cdist/conf/type/__git/man.rst @@ -36,7 +36,7 @@ owner User to chown to. recursive - Recursive clone... + Passes the --recursive flag to git when cloning the repository. EXAMPLES --------