From a40781b54838f4968046211bd2a0d49a6362a03d Mon Sep 17 00:00:00 2001 From: Gary Kotton Date: Sun, 30 Dec 2012 08:33:35 +0000 Subject: [PATCH] Ensures that the dnsmasq configuration file flag is always set 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 | 4 ++-- quantum/tests/unit/test_linux_dhcp.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/quantum/agent/linux/dhcp.py b/quantum/agent/linux/dhcp.py index e1586befd..1df41439d 100644 --- a/quantum/agent/linux/dhcp.py +++ b/quantum/agent/linux/dhcp.py @@ -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) diff --git a/quantum/tests/unit/test_linux_dhcp.py b/quantum/tests/unit/test_linux_dhcp.py index 5eaf0b971..7b54e4604 100644 --- a/quantum/tests/unit/test_linux_dhcp.py +++ b/quantum/tests/unit/test_linux_dhcp.py @@ -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' -- 2.45.2