Fixes on domain backend

This commit is contained in:
Marc 2014-10-17 13:51:33 +00:00
parent 5600ed4c51
commit 46e4c13899
1 changed files with 9 additions and 5 deletions

View File

@ -40,10 +40,14 @@ class Bind9MasterDomainBackend(ServiceController):
def update_conf(self, context):
self.append(textwrap.dedent("""\
cat -s <(sed -e 's/^};/};\n/' named.conf.local) | \\
cat -s <(sed -e 's/^};/};\\n/' %(conf_path)s) | \\
awk -v s=pangea.cat 'BEGIN { RS=""; s="zone \\""s"\\"" } $0~s{ print }' | \\
diff -I"^\s*//" - <(echo '%(conf)s') || {
echo -e '%(conf)s' >> %(conf_path)s
cat -s <(sed -e 's/^};/};\\n/' %(conf_path)s) | \\
awk -v s="%(name)s" 'BEGIN { RS=""; s="zone \\""s"\\"" } $0!~s{ print $0"\\n" }' \\
> %(conf_path)s.tmp
echo -e '%(conf)s' >> %(conf_path)s.tmp
mv %(conf_path)s.tmp %(conf_path)s
UPDATED=1
}""" % context
))
@ -61,7 +65,7 @@ class Bind9MasterDomainBackend(ServiceController):
# These can never be top level domains
return
self.append(textwrap.dedent("""\
cat -s <(sed -e 's/^};/};\\n/' named.conf.local) | \\
cat -s <(sed -e 's/^};/};\\n/' %(conf_path)s) | \\
awk -v s="%(name)s" 'BEGIN { RS=""; s="zone \\""s"\\"" } $0!~s{ print $0"\\n" }' \\
> %(conf_path)s.tmp""" % context
))