Implement a helper script for zone reloads
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`.
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
#!/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
|
||||
@@ -0,0 +1,3 @@
|
||||
<%- @zones.each do |zone| -%>
|
||||
<%= zone %>:<%= @name %>
|
||||
<%- end -%>
|
||||
Reference in New Issue
Block a user