← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~rvb/maas/rm-symlink into lp:maas

 

Raphaël Badin has proposed merging lp:~rvb/maas/rm-symlink into lp:maas.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~rvb/maas/rm-symlink/+merge/114579

This branch modifies the place where the bindfixture generates its configuration files when the dns bind service is run.

We originally decided to generate these configuration files in run/named to make it clear that these files were generated.  But, since we wanted to have the config files in etc/named, we created a symlink in etc: (cd etc && ln -s ../run/named named).

Andres pointed out a few problems with that:
- we ship a broken link in the source tree (the link ceases to be broken when the configuration gets generated)
- links don't play nice with tar (issues when setting mtime or mode)

So I've decided to clean this up.  The configuration now gets generated directly in etc/named and I've added a header to make it clear that the configuration files in there are generated.
-- 
https://code.launchpad.net/~rvb/maas/rm-symlink/+merge/114579
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~rvb/maas/rm-symlink into lp:maas.
=== modified file '.bzrignore'
--- .bzrignore	2012-07-09 15:43:05 +0000
+++ .bzrignore	2012-07-12 07:31:26 +0000
@@ -13,6 +13,7 @@
 ./docs/_autosummary
 ./docs/_build
 ./docs/api.rst
+./etc/named
 ./eggs
 ./include
 ./lib

=== modified file 'Makefile'
--- Makefile	2012-07-09 16:04:47 +0000
+++ Makefile	2012-07-12 07:31:26 +0000
@@ -139,6 +139,7 @@
 	$(RM) -r docs/_build
 	$(RM) -r run/* services/*/supervise
 	$(RM) twisted/plugins/dropin.cache
+	$(RM) -r etc/named
 
 harness: bin/maas bin/database
 	$(dbrun) bin/maas shell --settings=maas.demo

=== modified file 'etc/democeleryconfig.py'
--- etc/democeleryconfig.py	2012-07-11 09:06:57 +0000
+++ etc/democeleryconfig.py	2012-07-12 07:31:26 +0000
@@ -25,4 +25,4 @@
 
 
 DNS_CONFIG_DIR = os.path.join(
-    DEV_ROOT_DIRECTORY, 'run/named/')
+    DEV_ROOT_DIRECTORY, 'etc/named/')

=== removed symlink 'etc/named'
=== target was u'../run/named'
=== modified file 'services/dns/run'
--- services/dns/run	2012-07-09 16:12:58 +0000
+++ services/dns/run	2012-07-12 07:31:26 +0000
@@ -14,6 +14,6 @@
 
 # Run named.
 exec bin/py -m maastesting.bindfixture -- \
-    --homedir `pwd`/run/named \
+    --homedir `pwd`/etc/named \
     --log-file `pwd`/logs/dns/current \
     --port 5244 --rndc-port 5245

=== modified file 'src/maastesting/bindfixture.py'
--- src/maastesting/bindfixture.py	2012-07-11 10:53:35 +0000
+++ src/maastesting/bindfixture.py	2012-07-12 07:31:26 +0000
@@ -33,6 +33,14 @@
 from testtools.content_type import UTF8_TEXT
 
 
+GENERATED_HEADER = """
+# This is a file generated by the bindfixture.
+# The bindfixture tries not to overwrite existing configuration files
+# so it's safe to edit this file if you need to but be aware that
+# these changes won't be persisted.
+"""
+
+
 def should_write(path, overwrite_config=False):
     """Does the DNS config file at `path` need writing?
 
@@ -123,10 +131,12 @@
                     homedir=self.homedir, port=self.port,
                     log_file=self.log_file,
                     extra=namedrndcconf))
-            atomic_write(named_conf, self.conf_file)
+            atomic_write(
+                GENERATED_HEADER + named_conf, self.conf_file)
         # Write rndc config file.
         if should_write(self.rndcconf_file, overwrite_config):
-            atomic_write(rndcconf, self.rndcconf_file)
+            atomic_write(
+                GENERATED_HEADER + rndcconf, self.rndcconf_file)
 
         # Copy named executable to home dir.  This is done to avoid
         # the limitations imposed by apparmor if the executable