use __remote_{exec,copy} instead of plain ssh/scp in remote exec scripts

Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
remotes/origin/4.6
Steven Armstrong 7 years ago
parent e9f8cb6f49
commit 04c8415060
  1. 8
      cdist/conf/type/__install_config/files/remote/copy
  2. 10
      cdist/conf/type/__install_config/files/remote/exec

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh -e
# #
# 2011 Steven Armstrong (steven-cdist at armstrong.cc) # 2011-2017 Steven Armstrong (steven-cdist at armstrong.cc)
# #
# This file is part of cdist. # This file is part of cdist.
# #
@ -32,8 +32,6 @@ log() {
chroot="$1"; shift chroot="$1"; shift
target_host="$__target_host" target_host="$__target_host"
scp="scp -o User=root -q"
# postfix target_host with chroot location # postfix target_host with chroot location
code="$(echo "$@" | sed "s|$target_host:|$target_host:$chroot|g")" code="$(echo "$@" | sed "s|$target_host:|$target_host:$chroot|g")"
@ -43,6 +41,6 @@ log "@: $@"
log "code: $code" log "code: $code"
# copy files into chroot # copy files into chroot
$scp $code $__remote_copy $code
log "-----" log "-----"

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh -e
# #
# 2011-2013 Steven Armstrong (steven-cdist at armstrong.cc) # 2011-2017 Steven Armstrong (steven-cdist at armstrong.cc)
# #
# This file is part of cdist. # This file is part of cdist.
# #
@ -34,11 +34,9 @@ target_host="$__target_host"
# In exec mode the first argument is the __target_host which we already got from env. Get rid of it. # In exec mode the first argument is the __target_host which we already got from env. Get rid of it.
shift shift
ssh="ssh -o User=root -q $target_host"
# escape ' with '"'"' # escape ' with '"'"'
code="$(echo "$@" | sed -e "s/'/'\"'\"'/g")" code="$(echo "$@" | sed -e "s/'/'\"'\"'/g")"
code="$ssh chroot $chroot sh -c '$code'" code="chroot $chroot sh -e -c '$code'"
log "target_host: $target_host" log "target_host: $target_host"
log "chroot: $chroot" log "chroot: $chroot"
@ -46,6 +44,6 @@ log "@: $@"
log "code: $code" log "code: $code"
# Run the code # Run the code
$code $__remote_exec $target_host $code
log "-----" log "-----"

Loading…
Cancel
Save