# HG changeset patch # User Tero Marttila # Date 1332342660 -7200 # Node ID a88766722d18944a7aca8467d96fd43f98839e05 # Parent 65bf391fd2f38e9cb6fee186f9f1330bcbaa0b8f update: rename dhcp hosts -> dhcp conf, makes more sense; check input files before linking diff -r 65bf391fd2f3 -r a88766722d18 .hgignore --- 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/ diff -r 65bf391fd2f3 -r a88766722d18 bin/update --- 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 } diff -r 65bf391fd2f3 -r a88766722d18 lib/update.operations --- 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