update: rename dhcp hosts -> dhcp conf, makes more sense; check input files before linking
--- a/.hgignore Wed Mar 21 17:04:21 2012 +0200
+++ b/.hgignore Wed Mar 21 17:11:00 2012 +0200
@@ -3,8 +3,8 @@
\.pyc$
# output
-^serials/
^zones/
+^dhcp/
# data
^settings/
--- a/bin/update Wed Mar 21 17:04:21 2012 +0200
+++ b/bin/update Wed Mar 21 17:11:00 2012 +0200
@@ -96,8 +96,8 @@
# List of actual domains used; will be linked to $DOMAIN_BASE
DOMAINS=(paivola.fi paivola.net paivola.org paivola.info paivola.mobi xn--pivl-load8j.fi)
-# Names of dhcp hosts files
-DHCP_HOSTS=(paivola veturi verstas)
+# Names of dhcp conf files
+DHCP_CONFS=(paivola veturi verstas)
## Operate!
# these functions are all defined in lib/update.operations
@@ -190,14 +190,15 @@
# Update $DHCP files from $DATA/dhcp
function run_dhcp {
- log "Linking DHCP hosts..."
- for hosts in "${DHCP_HOSTS[@]}"; do
- # hosts base
- link_dhcp_hosts $hosts
- check_dhcp_hosts $hosts
+ log "Linking DHCP configs..."
+ for conf in "${DHCP_CONFS[@]}"; do
+ # conf base
+ check_dhcp_conf $conf
+ link_dhcp_conf $conf
done
log "Testing dhcp..."
+ # this is partially redundant with the above check_dhcp_hosts, but doesn't matter
check_dhcp
}
--- a/lib/update.operations Wed Mar 21 17:04:21 2012 +0200
+++ b/lib/update.operations Wed Mar 21 17:11:00 2012 +0200
@@ -192,12 +192,12 @@
link_generic $out $tgt
}
-## Link dhcp file directly from data to hosts
-function link_dhcp_hosts {
- local hosts=$1
- local base=${2:-$hosts}
+## Link dhcp file directly from data to $DHCP
+function link_dhcp_conf {
+ local conf=$1
+ local base=${2:-$conf}
- local out=$DHCP/$hosts.conf
+ local out=$DHCP/$conf.conf
local tgt=$(choose_link $out $DHCP/$base.conf $DHCP_DATA/$base.conf)
link_generic $out $tgt
@@ -275,14 +275,14 @@
fi
}
-## Test DHCP configuration of given hosts file using check_dhcp $DHCP/$host.conf:
-#
-# check_dhcp_hosts $host
+## Test DHCP configuration of given settings/dhcp using check_dhcp $DHCP_DATA/$host.conf:
#
-function check_dhcp_hosts {
- local host=$1
+# check_dhcp_conf $conf
+#
+function check_dhcp_conf {
+ local conf=$1
- check_dhcp $DHCP/$host.conf
+ check_dhcp $DHCP_DATA/$conf.conf
}
# Run rndc reload