update_zone --include-path, log_check dns-new
authorTero Marttila <terom@paivola.fi>
Thu, 19 Dec 2013 03:08:19 +0200
branchdns-new
changeset 90 5b33ccac38ad
parent 89 51270237a6ff
child 91 acb2fb235eb2
update_zone --include-path, log_check
bin/update
lib/update.log
lib/update.operations
--- a/bin/update	Thu Dec 19 02:38:03 2013 +0200
+++ b/bin/update	Thu Dec 19 03:08:19 2013 +0200
@@ -81,11 +81,16 @@
     for zone in $(list_files etc/zones); do
         update_zone         "var/zones/$zone"               "etc/zones/$zone"       "var/serials/$zone"
     done
-
+    
+    ## Check
     log "Testing zones..."
     for zone in $(list_files etc/zones); do
-        # check_zone          var/zones/$zone     $zone
-        log_warn "TODO: check_zone $zone"
+        check_zone          "var/zones/$zone"       $zone
+    done
+
+    log "Testing dhcp hosts..."
+    for conf in var/dhcp/*.conf; do
+        check_dhcp          $conf
     done
 
     ## Deploy
--- a/lib/update.log	Thu Dec 19 02:38:03 2013 +0200
+++ b/lib/update.log	Thu Dec 19 03:08:19 2013 +0200
@@ -41,6 +41,10 @@
     [ $LOG_UPDATE   ] && log_color '36'     "  $*"          || true
 }
 
+function log_check {
+    [ $LOG_UPDATE   ] && log_color '37'     "  $*"          || true
+}
+
 function log_noop {
     [ $LOG_NOOP     ] && log_color '2;34'   "  $*"          || true
 }
--- a/lib/update.operations	Thu Dec 19 02:38:03 2013 +0200
+++ b/lib/update.operations	Thu Dec 19 03:08:19 2013 +0200
@@ -178,6 +178,7 @@
         log_update "Generating $out <- $src..." 
 
         do_update "$out" $OPT/bin/pvl.dns-zone "$src" \
+                --include-path=$SRV/var/zones   \
                 $serial_opt
     else
         log_skip "Generating $out <- $src: not changed" 
@@ -202,6 +203,8 @@
     local zone=$1
     local origin=$2
 
+    log_check "Checking $zone @ $origin..." 
+
     # checkzone is very specific about the order of arguments, -q must be first
     check $zone $NAMED_CHECKZONE $origin $zone
 }
@@ -214,6 +217,8 @@
 # Fails if the check fails.
 function check_dhcp {
     local conf=${1:-$DHCPD_CONF}
+    
+    log_check "Checking DHCP $conf..." 
 
     if [ ! -e $DHCPD ]; then
         log_warn "check_dhcp: dhcpd not installed, skipping: $conf"