]> git.donarmstrong.com Git - dsa-puppet.git/commitdiff
Properly ignore commented out lines
authorPeter Palfrader <peter@palfrader.org>
Fri, 26 Apr 2013 12:34:12 +0000 (14:34 +0200)
committerPeter Palfrader <peter@palfrader.org>
Fri, 26 Apr 2013 12:34:12 +0000 (14:34 +0200)
modules/roles/files/static-mirroring/static-master-update-component
modules/roles/files/static-mirroring/static-update-component
modules/roles/files/static-mirroring/staticsync-ssh-wrap

index e01c7343d3fbff995e6113649781859f40f1ace2..64836ba2bc0172601a8222d26e74a96bf4fc092e 100755 (executable)
@@ -81,8 +81,8 @@ if [ "${component%/*}" != "$component" ] ; then
   exit 1
 fi
 
-srchost="$(awk -v this_host="$(hostname -f)" -v component="$component" '$1 == this_host && $2 == component {print $3; exit}' "$componentlist")"
-srcdir="$(awk -v this_host="$(hostname -f)" -v component="$component" '$1 == this_host && $2 == component {print $4; exit}' "$componentlist")"
+srchost="$(awk -v this_host="$(hostname -f)" -v component="$component" '!/^ *(#|$)/ && $1 == this_host && $2 == component {print $3; exit}' "$componentlist")"
+srcdir="$(awk -v this_host="$(hostname -f)" -v component="$component" '!/^ *(#|$)/ && $1 == this_host && $2 == component {print $4; exit}' "$componentlist")"
 if [ -z "$srchost" ] || [ -z "$srcdir" ]; then
   echo >&2 "$0: Invalid component: $component (not found in $componentlist)";
   exit 1
index 2cae0b8b4c6059412bd62a4f088bacf701822dba..27b9318e19df4278000813e2c5841b2f46d4018e 100755 (executable)
@@ -41,12 +41,12 @@ if [ "${component%/*}" != "$component" ] ; then
 fi
 
 thishost=$(hostname -f)
-masterhost="$(awk -v component="$component" '$2 == component {print $1; exit}' "$componentlist")"
-srchost="$(awk -v component="$component" '$2 == component {print $3; exit}' "$componentlist")"
-srcdir="$(awk -v component="$component" '$2 == component {print $4; exit}' "$componentlist")"
+masterhost="$(awk -v component="$component" '!/^ *(#|$)/ && $2 == component {print $1; exit}' "$componentlist")"
+srchost="$(awk -v component="$component" '!/^ *(#|$)/ && $2 == component {print $3; exit}' "$componentlist")"
+srcdir="$(awk -v component="$component" '!/^ *(#|$)/ && $2 == component {print $4; exit}' "$componentlist")"
 inextralist="$(
                awk -v component="$component" -v host="$thishost" '
-                 $2 == component {
+                 !/^ *(#|$)/ && $2 == component {
                    split($5,extra,",")
                    for (i in extra) {
                      if (host == extra[i]) {
index 2cb8c317928a0089c1e0e7fdb513118bf8417915..c1bf233170ebd9850c13f0c52e5037b4d0b51027 100755 (executable)
@@ -59,7 +59,7 @@ do_mirror() {
        one_more_arg "$@"
        local serial="$1"; shift
 
-       masterhost="$(awk -v component="$component" '$2 == component {print $1; exit}' "$COMPONENTLIST")"
+       masterhost="$(awk -v component="$component" '!/^ *(#|$)/ && $2 == component {print $1; exit}' "$COMPONENTLIST")"
        if [ -z "$masterhost" ]; then
                croak "Did not find master for component $component."
        elif [ "$masterhost" != "$remote_host" ]; then
@@ -76,7 +76,7 @@ do_rsync_on_master() {
        local remote_host="$1"; shift
        local args="--server --sender -vlHtrze.iLsf --safe-links ."
 
-       for component in $(awk -v this_host="$(hostname -f)" '$1 == this_host {print $2}' $COMPONENTLIST); do
+       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"
@@ -104,7 +104,7 @@ do_rsync_on_source() {
        allowed_rsyncs=()
 
        if [ -e "$COMPONENTLIST" ]; then
-               for path in $(awk -v host="$(hostname -f)" '$3 == host {print $4}' $COMPONENTLIST); do
+               for path in $(awk -v host="$(hostname -f)" '!/^ *(#|$)/ && $3 == host {print $4}' $COMPONENTLIST); do
                        allowed_rsyncs+=("--server --sender -lHtrze.iLsf --safe-links . $path/.")
                done
        fi
@@ -136,7 +136,7 @@ do_update_component() {
 
        hit="$(
                awk -v this_host="$(hostname -f)" -v component="$component" -v host="$remote_host" '
-                       $1 == this_host && $2 == component {
+                       !/^ *(#|$)/ && $1 == this_host && $2 == component {
                                if ($3 == host) {
                                        print $4
                                        exit