DHCP: fix default dns search name
If no override for dns_domain has been added by the user on the
tentant network, the default dns_domain should be used. Prior to
this fix, dns_domain got set to '' instead.
Closes-bug: #1774710
Change-Id: If206b943703eb638f7b22e59791ed8876f46f556
(cherry picked from commit 7fdd6adc7a
)
This commit is contained in:
parent
3c3257b852
commit
b7796f6c91
|
@ -130,7 +130,8 @@ class DhcpBase(object):
|
|||
version=None, plugin=None):
|
||||
self.conf = conf
|
||||
self.network = network
|
||||
self.dns_domain = self.network.get('dns_domain', self.conf.dns_domain)
|
||||
self.dns_domain = (self.network.get('dns_domain') or
|
||||
self.conf.dns_domain)
|
||||
self.process_monitor = process_monitor
|
||||
self.device_manager = DeviceManager(self.conf, plugin)
|
||||
self.version = version
|
||||
|
|
|
@ -462,10 +462,10 @@ class FakeV4SubnetAgentWithNoDnsProvided(FakeV4Subnet):
|
|||
|
||||
|
||||
class FakeNetworkBase(object):
|
||||
dns_domain = 'openstacklocal'
|
||||
dns_domain = ''
|
||||
|
||||
def get(self, attr, default=None):
|
||||
return getattr(self, attr) or default
|
||||
def get(self, attr):
|
||||
return getattr(self, attr)
|
||||
|
||||
|
||||
class FakeV4MultipleAgentsWithoutDnsProvided(FakeNetworkBase):
|
||||
|
@ -1333,6 +1333,11 @@ class TestDnsmasq(TestBase):
|
|||
self.safe.assert_has_calls([mock.call(exp_host_name, exp_host_data),
|
||||
mock.call(exp_addn_name, exp_addn_data)])
|
||||
|
||||
def test_spawn_with_dns_domain_default(self):
|
||||
network = FakeDualNetwork()
|
||||
self._test_spawn(
|
||||
['--conf-file=', '--domain=openstacklocal'], network=network)
|
||||
|
||||
def test_spawn_with_dns_domain_conf(self):
|
||||
self.conf.set_override('dns_domain', 'starwars.local')
|
||||
network = FakeDualNetwork(domain=None)
|
||||
|
|
Loading…
Reference in New Issue