← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~rvb/maas/dns-service-bootstrap into lp:maas

 

Raphaël Badin has proposed merging lp:~rvb/maas/dns-service-bootstrap into lp:maas.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~rvb/maas/dns-service-bootstrap/+merge/115315

This branch change the way the DNS service is started to include MAAS' configuration.
-- 
https://code.launchpad.net/~rvb/maas/dns-service-bootstrap/+merge/115315
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~rvb/maas/dns-service-bootstrap into lp:maas.
=== modified file 'services/dns/run'
--- services/dns/run	2012-07-12 15:18:10 +0000
+++ services/dns/run	2012-07-17 11:16:43 +0000
@@ -12,8 +12,23 @@
 # because there are race issues when restarting.
 [ -z "${logdir:-}" ] || exec &>> "${logdir}/current"
 
+homedir=`pwd`/run/named
+log_file=`pwd`/logs/dns/current
+port=5246
+rndc_port=5247
+# Create DNS config.
+bin/py -m maastesting.bindfixture -- \
+    --create_config --overwrite_config \
+    --homedir $homedir \
+    --log-file $log_file \
+    --port $port --rndc-port $rndc_port
+# Create MAAS' DNS config.
+./bin/maas set_up_dns
+# Edit the fixture's named.conf to include MAAS' DNS config.
+./bin/maas get_named_conf --edit --config_path \
+    `pwd`/run/named/named.conf
 # Run named.
 exec bin/py -m maastesting.bindfixture -- \
-    --homedir `pwd`/run/named \
-    --log-file `pwd`/logs/dns/current \
-    --port 5244 --rndc-port 5245
+    --homedir $homedir \
+    --log-file $log_file \
+    --port $port --rndc-port $rndc_port

=== modified file 'src/maastesting/bindfixture.py'
--- src/maastesting/bindfixture.py	2012-07-12 07:24:05 +0000
+++ src/maastesting/bindfixture.py	2012-07-17 11:16:43 +0000
@@ -308,9 +308,14 @@
         '--rndc-port', type=int,
         help="The rndc port that will be used by BIND")
     parser.add_argument(
-        '--overwrite_config', type=bool,
+        '--overwrite_config', action='store_true',
         help="Whether or not to overwrite the configuration files "
              "if they already exist", default=False)
+    parser.add_argument(
+        '--create_config', action='store_true',
+        help="If set, only create the config files instead of "
+             "also running the service.  Defaults to False.",
+        default=False)
     arguments = parser.parse_args()
 
     # Create homedir if it does not already exist.
@@ -324,6 +329,7 @@
         port=arguments.port, rndc_port=arguments.rndc_port)
     resources.setUp(overwrite_config=arguments.overwrite_config)
     # exec named.
-    os.execlp(
-        resources.named_file, resources.named_file, "-g", "-c",
-        resources.conf_file)
+    if not arguments.create_config:
+        os.execlp(
+            resources.named_file, resources.named_file, "-g", "-c",
+            resources.conf_file)