From 3693cc9bbbdf387679c6472db34405dff3c7a38f Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 16 Jun 2017 07:32:21 +0200 Subject: [PATCH] Backport __install_config from Steven Signed-off-by: Nico Schottelius --- .../type/__install_config/files/remote/copy | 2 +- .../type/__install_config/files/remote/exec | 7 +++-- .../conf/type/__install_config/gencode-local | 28 +++++-------------- 3 files changed, 13 insertions(+), 24 deletions(-) diff --git a/cdist/conf/type/__install_config/files/remote/copy b/cdist/conf/type/__install_config/files/remote/copy index 5b6f555c..df6a3f06 100755 --- a/cdist/conf/type/__install_config/files/remote/copy +++ b/cdist/conf/type/__install_config/files/remote/copy @@ -25,7 +25,7 @@ # log() { - echo "$@" | logger -t "__install_config copy" + #echo "$@" | logger -t "__install_config copy" : } diff --git a/cdist/conf/type/__install_config/files/remote/exec b/cdist/conf/type/__install_config/files/remote/exec index 58e6b162..17375693 100755 --- a/cdist/conf/type/__install_config/files/remote/exec +++ b/cdist/conf/type/__install_config/files/remote/exec @@ -25,7 +25,7 @@ # log() { - echo "$@" | logger -t "__install_config exec" + #echo "$@" | logger -t "__install_config exec" : } @@ -35,7 +35,10 @@ target_host="$__target_host" shift ssh="ssh -o User=root -q $target_host" -code="$ssh chroot $chroot sh -c '$@'" + +# escape ' with '"'"' +code="$(echo "$@" | sed -e "s/'/'\"'\"'/g")" +code="$ssh chroot $chroot sh -c '$code'" log "target_host: $target_host" log "chroot: $chroot" diff --git a/cdist/conf/type/__install_config/gencode-local b/cdist/conf/type/__install_config/gencode-local index 674dec25..3767253e 100755 --- a/cdist/conf/type/__install_config/gencode-local +++ b/cdist/conf/type/__install_config/gencode-local @@ -1,6 +1,6 @@ #!/bin/sh # -# 2011 Steven Armstrong (steven-cdist at armstrong.cc) +# 2011-2017 Steven Armstrong (steven-cdist at armstrong.cc) # # This file is part of cdist. # @@ -22,29 +22,15 @@ chroot="$(cat "$__object/parameter/chroot")" remote_exec="$__type/files/remote/exec" remote_copy="$__type/files/remote/copy" -cdist_args="-v" -[ "$__debug" = "yes" ] && cdist_args="$cdist_args -d" +cdist_args="" +[ "$__verbose" = "yes" ] && cdist_args="-vv" +[ "$__debug" = "yes" ] && cdist_args="-d" cat << DONE -#echo "__apt_noautostart --state present" \ -# | cdist $cdist_args \ -# config \ -# --initial-manifest - \ -# --remote-exec="$remote_exec $chroot" \ -# --remote-copy="$remote_copy $chroot" \ -# $__target_host - -cdist $cdist_args \ - config \ +cdist config \ + $cdist_args \ --remote-exec="$remote_exec $chroot" \ --remote-copy="$remote_copy $chroot" \ $__target_host - -#echo "__apt_noautostart --state absent" \ -# | cdist $cdist_args \ -# config \ -# --initial-manifest - \ -# --remote-exec="$remote_exec $chroot" \ -# --remote-copy="$remote_copy $chroot" \ -# $__target_host DONE +