update: use pvl.dns-process for update_zone
authorTero Marttila <tero.marttila@aalto.fi>
Fri, 27 Feb 2015 17:02:44 +0200
changeset 643 eda838f84366
parent 642 c25834508569
child 644 c51eb0151fec
update: use pvl.dns-process for update_zone
lib/pvl/hosts/zone.sh
--- a/lib/pvl/hosts/zone.sh	Fri Feb 27 17:02:13 2015 +0200
+++ b/lib/pvl/hosts/zone.sh	Fri Feb 27 17:02:44 2015 +0200
@@ -1,6 +1,8 @@
 #HOSTS_CHARSET='utf-8'
 HOSTS_INCLUDE="$ETC/hosts"
 
+ZONES_INCLUDE="$VAR/zones"
+
 NAMED_CHECKZONE=/usr/sbin/named-checkzone
 
 RNDC=/usr/sbin/rndc
@@ -95,12 +97,11 @@
     done
 }
 
-## Generate new serial for zone using pvl.dns-serial, if the zone data has changed:
+## Update the cached .serial for the given zone, if the zone has changed:
 #
-#   update_serial   .../serials/$zone   $serial     $deps...
+#   update_serial var/serials/$zone $serial $deps...
 #
-# Supports SERIAL_FORCE/NOOP.
-# Updates $SERIALS/$zone.serial.
+# Supports UPDATE_SERIAL=
 function update_zone_serial {
     local out="$1"
     local serial="$2"
@@ -128,9 +129,11 @@
     echo "$serial" > $out
 }
 
-## Generate zone file from source using pvl.dns-zone:
+## Generate zone file from source using pvl.dns-process:
 #
-#   update_zone out/zones/$zone in/zones/$zone var/serials/$zone
+#   update_zone var/zones/$zone etc/zones/$zone var/serials/$zone
+#
+# Sets the SOA serial, and adjusts the $INCLUDE paths
 function update_zone {
     local out="$1"
     local src="$2"
@@ -141,7 +144,7 @@
     if [ -n "$serial" -a -f "$serial" ]; then
         serial_opt="--serial=$(cat "$serial")"
     elif [ "$UPDATE_SERIAL" = 0 ]; then
-        warn "$out: noop'd serial, omitting"
+        warn "$out: omit noop'd serial"
     else
         fail "$out: missing serial: $serial"
     fi
@@ -151,9 +154,9 @@
     else
         log_apply "$msg"
 
-        apply_cmd "$out" $OPT/bin/pvl.dns-zone \
-                --include-path=$VAR/zones  \
+        apply_cmd "$out" $OPT/bin/pvl.dns-process \
                 $serial_opt \
+                --include-path=$ZONES_INCLUDE \
                 "$src"
     fi
 }