]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Ensures that the dnsmasq configuration file flag is always set
authorGary Kotton <gkotton@redhat.com>
Sun, 30 Dec 2012 08:33:35 +0000 (08:33 +0000)
committerGary Kotton <gkotton@redhat.com>
Sun, 30 Dec 2012 08:33:35 +0000 (08:33 +0000)
Fixes bug 1094183

If the flag is not set then the default configuration file may
be used. This may be problematic in certain setups.

Change-Id: Ibd0be960779f391a198454510dd6edcbc69c149c

quantum/agent/linux/dhcp.py
quantum/tests/unit/test_linux_dhcp.py

index e1586befddce7988e37f61b8d306dabc0a5ae834..1df41439d682f8cd596fd8b476ffbc2baf932002 100644 (file)
@@ -44,6 +44,7 @@ OPTS = [
                default='openstacklocal',
                help='Domain to use for building the hostnames'),
     cfg.StrOpt('dnsmasq_config_file',
+               default='',
                help='Override the default dnsmasq settings with this file'),
     cfg.StrOpt('dnsmasq_dns_server',
                help='Use another DNS server before any in /etc/resolv.conf.'),
@@ -247,8 +248,7 @@ class Dnsmasq(DhcpLocalProcess):
                         mode,
                         self.conf.dhcp_lease_time))
 
-        if self.conf.dnsmasq_config_file:
-            cmd.append('--conf-file=%s' % self.conf.dnsmasq_config_file)
+        cmd.append('--conf-file=%s' % self.conf.dnsmasq_config_file)
         if self.conf.dnsmasq_dns_server:
             cmd.append('--server=%s' % self.conf.dnsmasq_dns_server)
 
index 5eaf0b971a50b51a544178037db2413b4818bf76..7b54e4604b389e9fdbee73681a0c6abdd52f8b58 100644 (file)
@@ -434,7 +434,7 @@ class TestDnsmasq(TestBase):
              'dnsmasq-lease-update'),
             '--leasefile-ro',
             '--dhcp-range=set:tag0,192.168.0.0,static,120s',
-            '--dhcp-range=set:tag1,fdca:3ba5:a17a:4ba3::,static,120s'
+            '--dhcp-range=set:tag1,fdca:3ba5:a17a:4ba3::,static,120s',
         ]
         expected.extend(extra_options)
 
@@ -466,7 +466,7 @@ class TestDnsmasq(TestBase):
                                                      check_exit_code=True)
 
     def test_spawn(self):
-        self._test_spawn([])
+        self._test_spawn(['--conf-file='])
 
     def test_spawn_cfg_config_file(self):
         self.conf.set_override('dnsmasq_config_file', '/foo')
@@ -474,7 +474,7 @@ class TestDnsmasq(TestBase):
 
     def test_spawn_cfg_dns_server(self):
         self.conf.set_override('dnsmasq_dns_server', '8.8.8.8')
-        self._test_spawn(['--server=8.8.8.8'])
+        self._test_spawn(['--conf-file=', '--server=8.8.8.8'])
 
     def test_output_opts_file(self):
         fake_v6 = 'gdca:3ba5:a17a:4ba3::1'