]> git.donarmstrong.com Git - dsa-puppet.git/commitdiff
several fixes
authorPeter Palfrader <peter@palfrader.org>
Thu, 25 Apr 2013 12:48:24 +0000 (14:48 +0200)
committerPeter Palfrader <peter@palfrader.org>
Thu, 25 Apr 2013 12:48:24 +0000 (14:48 +0200)
modules/roles/files/static-mirroring/static-master-ssh-wrap
modules/roles/files/static-mirroring/static-mirror-run
modules/roles/files/static-mirroring/static-mirror-ssh-wrap
modules/roles/manifests/static_mirror.pp

index da162159ac51d4935c03228012b0cbb3f1120524..d66f282fe5fb9c12a90f44a2f91e2ee54471d326 100755 (executable)
@@ -76,12 +76,12 @@ do_rsync() {
 
        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/$component-current-push"
+                 local path="$BASEDIR/master/$component-current-push"
                  info "serving $remote_host with $path"
                  rsync $args "$path/."
                  return
-         elif [ "$*" = "$args . $component/-live-/" ] || [ "$*" = "$args . ./$component/-live-/" ] ; then
-                 local path="$BASEDIR/$component-current-live"
+         elif [ "$*" = "$args $component/-live-/" ] || [ "$*" = "$args ./$component/-live-/" ] ; then
+                 local path="$BASEDIR/master/$component-current-live"
                  info "host $remote_host wants $path, acquiring lock"
                  lock 200 "$path" 0
                  rsync $args "$path/."
index 72f7aea610e7f500a05c87fa488abf9024c4001f..0f7bc14c9e724e828c91ba3d224d387fc014715d 100755 (executable)
@@ -106,6 +106,7 @@ log() {
 }
 
 lock() {
+       mkdir -p "$BASEDIR"
        exec 200< "$BASEDIR"
        if ! flock -e 200; then
                log "Cannot acquire lock."
@@ -125,12 +126,12 @@ lock
 if [ -e "${BASEDIR}${ACTIVE}" ] && [ "$(readlink "${BASEDIR}${ACTIVE}")" = "$ALPHA" ] ; then
        staging="$BRAVO"
        active="$ALPHA"
-elif [ -e "${BASEDIR}${ACTIVE}" ] && [ "$(readlink "${BASEDIR}${ACTIVE}")" = "$BRAVO" ] ; then
-       staging="$ALPHA"
-       active="$BRAVO"
-else
+elif [ -e "${BASEDIR}${ACTIVE}" ] && [ "$(readlink "${BASEDIR}${ACTIVE}")" != "$BRAVO" ] ; then
        echo >&5 "Invalid state of ${BASEDIR}${ACTIVE}."
        exit 1
+else
+       staging="$ALPHA"
+       active="$BRAVO"
 fi
 log "active is $active; staging is $staging"
 
index 4ee9bbd0007b4af31514e631b1a2abe10b0327c4..a76c6455b8c4c43ed75ebb71a847536c430aba02 100755 (executable)
@@ -66,7 +66,7 @@ do_mirror() {
        local serial="$1"; shift
 
        info "Host $remote_host triggered a mirror run for $component, serial $serial"
-       exec /usr/local/bin/static-mirror-run "$basedir/$component" "$remote_host:$component/-new-" "$serial"
+       exec /usr/local/bin/static-mirror-run "$basedir/mirrors/$component" "$remote_host:$component/-new-" "$serial"
        echo >&2 "Exec failed"
        croak "exec failed"
 }
index 5c5622efe3c61b1498f1a9a99db1a79199df9b54..01e5336fa51255651a8f3752e3eb5ef988e4e358 100644 (file)
@@ -24,7 +24,7 @@ class roles::static_mirror {
        }
 
        file { '/etc/cron.d/puppet-static-mirror':
-                       content => "PATH=/usr/local/bin:/usr/bin:/bin\n@reboot staticsync sleep 60; for a in `awk '!/^ *(#|$)/ {printf \"%s:%s/-live-\\n\", $1, $2}' /etc/static-components.conf`; do static-mirror-run --one-stage /srv/static.debian.org \"$a\" > /dev/null; done\n",
+                       content => "PATH=/usr/local/bin:/usr/bin:/bin\n@reboot staticsync sleep 60; awk '!/^ *(#|$)/ {print \$1, \$2}' /etc/static-components.conf | while read master component; do static-mirror-run --one-stage /srv/static.debian.org/mirrors/\$component \"\$master:\$components/-live-\" > /dev/null; done\n",
        }
 
        $vhost_listen = $::hostname ? {