X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=modules%2Froles%2Ffiles%2Fstatic-mirroring%2Fstaticsync-ssh-wrap;h=ba880881f1fd874294a657c3f39dbd8a68f7b3b0;hb=7f18f21c8a9d538bac4a1ae874b492a80f432623;hp=2858f4d13527c9dc9b6967c46e53699c522283cf;hpb=eac14934062bb7f700b06bc17e8d259fbd18d6d9;p=mirror%2Fdsa-puppet.git diff --git a/modules/roles/files/static-mirroring/staticsync-ssh-wrap b/modules/roles/files/static-mirroring/staticsync-ssh-wrap index 2858f4d13..ba880881f 100755 --- a/modules/roles/files/static-mirroring/staticsync-ssh-wrap +++ b/modules/roles/files/static-mirroring/staticsync-ssh-wrap @@ -74,25 +74,31 @@ do_mirror() { do_rsync_on_master() { local remote_host="$1"; shift - local args="--server --sender -vlHtrze.iLsf --safe-links ." + local allowed_rsyncs + allowed_rsyncs=() + allowed_rsyncs+=("--server --sender -vlHtrze.iLsf --safe-links .") # wheezy + allowed_rsyncs+=("--server --sender -vlHtrze.iLsfx --safe-links .") # jessie - for component in $(awk -v this_host="$(hostname -f)" '!/^ *(#|$)/ && $1 == this_host {print $2}' $COMPONENTLIST); do - if [ "$*" = "$args $component/-new-/" ] || [ "$*" = "$args ./$component/-new-/" ] ; then - local path="$BASEDIR/master/$component-current-push" - info "serving $remote_host with $path" - exec rsync $args "$path/." - croak "Exec failed" - elif [ "$*" = "$args $component/-live-/" ] || [ "$*" = "$args ./$component/-live-/" ] ; then - local path="$BASEDIR/master/$component-current-live" - info "host $remote_host wants $path, acquiring lock" - exec 200< "$path" - if ! flock -s -w 0 200; then - echo >&2 "Cannot acquire shared lock on $path - this should mean an update is already underway anyway." - exit 1 + for cmd_idx in ${!allowed_rsyncs[*]}; do + args="${allowed_rsyncs[$cmd_idx]}" + for component in $(awk -v this_host="$(hostname -f)" '!/^ *(#|$)/ && $1 == this_host {print $2}' $COMPONENTLIST); do + if [ "$*" = "$args $component/-new-/" ] || [ "$*" = "$args ./$component/-new-/" ] ; then + local path="$BASEDIR/master/$component-current-push" + info "serving $remote_host with $path" + exec rsync $args "$path/." + croak "Exec failed" + elif [ "$*" = "$args $component/-live-/" ] || [ "$*" = "$args ./$component/-live-/" ] ; then + local path="$BASEDIR/master/$component-current-live" + info "host $remote_host wants $path, acquiring lock" + exec 200< "$path" + if ! flock -s -w 0 200; then + echo >&2 "Cannot acquire shared lock on $path - this should mean an update is already underway anyway." + exit 1 + fi + exec rsync $args "$path/." + croak "Exec failed" fi - exec rsync $args "$path/." - croak "Exec failed" - fi + done done } @@ -105,7 +111,8 @@ do_rsync_on_source() { if [ -e "$COMPONENTLIST" ]; then for path in $(awk -v host="$(hostname -f)" '!/^ *(#|$)/ && $3 == host {print $4}' $COMPONENTLIST); do - allowed_rsyncs+=("--server --sender -lHtrze.iLsf --safe-links . $path/.") + allowed_rsyncs+=("--server --sender -lHtrze.iLsf --safe-links . $path/.") # wheezy + allowed_rsyncs+=("--server --sender -lHtrze.iLsfx --safe-links . $path/.") # jessie done fi for cmd_idx in ${!allowed_rsyncs[*]}; do