From 46e4c13899713c59fda2bf1d1b18d551b7bdf8fa Mon Sep 17 00:00:00 2001 From: Marc Date: Fri, 17 Oct 2014 13:51:33 +0000 Subject: [PATCH] Fixes on domain backend --- orchestra/apps/domains/backends.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/orchestra/apps/domains/backends.py b/orchestra/apps/domains/backends.py index 9f790a95..0e18e5a0 100644 --- a/orchestra/apps/domains/backends.py +++ b/orchestra/apps/domains/backends.py @@ -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,9 +65,9 @@ class Bind9MasterDomainBackend(ServiceController): # These can never be top level domains return self.append(textwrap.dedent("""\ - cat -s <(sed -e 's/^};/};\\n/' named.conf.local) | \\ - awk -v s="%(name)s" 'BEGIN { RS=""; s="zone \\""s"\\"" } $0!~s{ print $0"\\n" }' \\ - > %(conf_path)s.tmp""" % context + 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 )) self.append('diff -I"^\s*//" %(conf_path)s.tmp %(conf_path)s || UPDATED=1' % context) self.append('mv %(conf_path)s.tmp %(conf_path)s' % context)