--- a/bin/update Fri Mar 16 15:03:11 2012 +0200
+++ b/bin/update Fri Mar 16 15:03:31 2012 +0200
@@ -370,17 +370,38 @@
fi
}
+function check_hosts {
+ local hosts=$1; shift 1
+
+ local cmd=($PROCESS_ZONE $PROCESS_ARGS $hosts --check-hosts "$@")
+
+ if "${cmd[@]}" -q; then
+ log_info "Check $hosts: OK"
+ else
+ log_error " Check $hosts: Failed"
+
+ indent " " "${cmd[@]}"
+
+ exit 1
+ fi
+}
+
function check_zone {
local name=$1
local file=$2
+ local cmd=($NAMED_CHECKZONE $name $file)
+
# test
+ # XXX: checkzone is very specific about the order of arguments, -q must be first
if $NAMED_CHECKZONE -q $name $file; then
log_info "Check $file($name): OK"
else
log_error " Check $file($name): Failed:"
- indent " " $NAMED_CHECKZONE $name $file
+ indent " " "${cmd[@]}"
+
+ exit 1
fi
}
@@ -390,14 +411,8 @@
parse_args "$@"
- log "Updating serials..."
-
- if [ $SERIAL_NOUPDATE ]; then
- log_info "Skipped"
- else
- update_serial $SERIALS/paivola.serial
- update_serial $SERIALS/paivola-reverse.serial
- fi
+ log "Testing hosts..."
+ check_hosts $SETTINGS/paivola.txt --check-exempt ufc
log "Generating host zones..."
update_hosts $ZONES/external/paivola.zone.hosts $SETTINGS/paivola.txt --forward-zone
@@ -410,6 +425,16 @@
copy_zone_part paivola internal
copy_zone_part paivola external
+ log "Updating serials..."
+
+ if [ $SERIAL_NOUPDATE ]; then
+ log_info "Skipped"
+ else
+ update_serial $SERIALS/paivola.serial
+ update_serial $SERIALS/paivola-reverse.serial
+ fi
+
+
log "Updating zones headers..."
update_zone paivola-reverse
update_zone_view paivola internal