← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~allenap/maas/no-extra-line-for-bind-bug-1066929 into lp:maas

 

Gavin Panella has proposed merging lp:~allenap/maas/no-extra-line-for-bind-bug-1066929 into lp:maas.

Commit message:
Don't start the BIND config include snippet from `maas get_named_conf` with a newline.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  Bug #1066929 in maas (Ubuntu): "duplicate entry added to named.conf.local on each package reconfigure"
  https://bugs.launchpad.net/ubuntu/+source/maas/+bug/1066929

For more details, see:
https://code.launchpad.net/~allenap/maas/no-extra-line-for-bind-bug-1066929/+merge/129893
-- 
https://code.launchpad.net/~allenap/maas/no-extra-line-for-bind-bug-1066929/+merge/129893
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~allenap/maas/no-extra-line-for-bind-bug-1066929 into lp:maas.
=== modified file 'src/maasserver/management/commands/get_named_conf.py'
--- src/maasserver/management/commands/get_named_conf.py	2012-07-16 13:22:56 +0000
+++ src/maasserver/management/commands/get_named_conf.py	2012-10-16 13:52:28 +0000
@@ -23,8 +23,8 @@
 from provisioningserver.dns.config import DNSConfig
 
 
-INCLUDE_SNIPPET_COMMENT = """
-# Append the following content to your  local BIND configuration
+INCLUDE_SNIPPET_COMMENT = """\
+# Append the following content to your local BIND configuration
 # file (usually /etc/bind/named.conf.local) in order to allow
 # MAAS to manage its DNS zones.
 """

=== modified file 'src/provisioningserver/dns/config.py'
--- src/provisioningserver/dns/config.py	2012-10-16 10:46:26 +0000
+++ src/provisioningserver/dns/config.py	2012-10-16 13:52:28 +0000
@@ -234,7 +234,8 @@
         }
 
     def get_include_snippet(self):
-        return '\ninclude "%s";\n' % self.target_path
+        assert '"' not in self.target_path, self.target_path
+        return 'include "%s";\n' % self.target_path
 
 
 def shortened_reversed_ip(ip, byte_num):

=== modified file 'src/provisioningserver/dns/tests/test_config.py'
--- src/provisioningserver/dns/tests/test_config.py	2012-10-16 10:06:22 +0000
+++ src/provisioningserver/dns/tests/test_config.py	2012-10-16 13:52:28 +0000
@@ -221,7 +221,7 @@
         self.assertThat(
             snippet,
             MatchesAll(
-                StartsWith('\n'),
+                Not(StartsWith('\n')),
                 EndsWith('\n'),
                 Contains(target_dir),
                 Contains('include "%s"' % dnsconfig.target_path)))