It turns out the `rndc` command that was intended to reload a managed zone wasn't working (see PR #91 for reference) if more than one view included the zone. The helper script is really just a wrapper around the `rndc` command itself, it translates its final parameter into a domain/class/view tuple and pass the leading parameters and the tuple to `rndc`.
20 lines
439 B
Plaintext
20 lines
439 B
Plaintext
#!/bin/bash
|
|
|
|
CONFDIR=<%= @confdir %>
|
|
|
|
function param_lookup() {
|
|
local zone_name="${1}"
|
|
local domain="$(grep "^${zone_name}:" ${CONFDIR}/domain-mappings.txt | cut -f2 -d:)"
|
|
grep "^${zone_name}:" ${CONFDIR}/view-mappings.txt | cut -f2 -d: | sed -e "s/\(.*\)/${domain} IN \1/"
|
|
}
|
|
|
|
zone_name="${!#}"
|
|
|
|
param_lookup "${zone_name}" | while read Z; do
|
|
if [ $# == 1 ]; then
|
|
echo $Z
|
|
else
|
|
sudo rndc "${@:1:$(($# - 1))}" $Z
|
|
fi
|
|
done
|