]> git.donarmstrong.com Git - dsa-puppet.git/commitdiff
Make it harder for args to get out of sync
authorPeter Palfrader <peter@palfrader.org>
Sat, 8 Dec 2012 18:09:41 +0000 (19:09 +0100)
committerPeter Palfrader <peter@palfrader.org>
Sat, 8 Dec 2012 18:09:41 +0000 (19:09 +0100)
modules/roles/files/static-mirroring/static-master-ssh-wrap

index b5c88be72321be8687474389b78ff878636fc5e0..94a41f407ded12c4bd3f48ebb8dc5410a111b1de 100755 (executable)
@@ -70,32 +70,19 @@ lock() {
   fi
 }
 
-serve_dir() {
-       local remote_host="$1"; shift
-       local path="$1"; shift
-
-       local sender='rsync --server --sender -vlogDtprze.iLsf . '
-
-       if [ -e "$path" ]; then
-               info "serving $remote_host with $path"
-               $sender "$path/"
-       else
-               info "$remote_host wants non-existing $path"
-               echo >&2 "$path does not exist."
-               exit 1
-       fi
-}
-
 do_rsync() {
        local remote_host="$1"; shift
 
-       if [ "$*" = "--server --sender -vltrze.iLsf --safe-links . -new-/" ] ; then
-               serve_dir "$remote_host" "$BASEDIR/current-push"
-       elif [ "$*" = "--server --sender -vltrze.iLsf --safe-links . -live-/" ] ; then
-               local p="$BASEDIR/current-live"
-               info "host $remote_host wants $p, acquiring lock"
-               lock 200 "$p" 0
-               serve_dir "$remote_host" "$p"
+       local args="--server --sender -vltrze.iLsf --safe-links ."
+       if [ "$*" = "$args -new-/" ] ; then
+               local path="$BASEDIR/current-push"
+               info "serving $remote_host with $path"
+               rsync $args "$path"
+       elif [ "$*" = "$args . -live-/" ] ; then
+               local path="$BASEDIR/current-live"
+               info "host $remote_host wants $path, acquiring lock"
+               lock 200 "$path" 0
+               rsync $args "$path"
        else
                info "NOT allowed for $remote_host: rsync $*"
                echo >&2 "This rsync command ($@) not allowed."