Set "VirtualHost" to reflect bindings
This patchset fixes the issue with IP address not being set properly in "VirtualHost" section of "openstack_https_frontend.conf" file when deploying reactive charms in the HA mode. Change-Id: Iee9f9d3621b0055bc62eaaed16d21b8f85113af9 Closes-Bug: 1745389
This commit is contained in:
parent
d83205fcf0
commit
33fd6a52b5
|
@ -800,12 +800,15 @@ class APIConfigurationAdapter(ConfigurationAdapter):
|
|||
"""
|
||||
addresses = []
|
||||
for net_type in ADDRESS_TYPES:
|
||||
net_cfg_opt = os_ip.ADDRESS_MAP[net_type]['config'].replace('-',
|
||||
'_')
|
||||
config_cidr = getattr(self, net_cfg_opt, None)
|
||||
addr = ch_ip.get_address_in_network(
|
||||
config_cidr,
|
||||
hookenv.unit_get('private-address'))
|
||||
net_cfg_opt = os_ip.ADDRESS_MAP[net_type]['config']
|
||||
config_cidr = getattr(self, net_cfg_opt.replace('-', '_'), None)
|
||||
if hookenv.config(net_cfg_opt):
|
||||
addr = ch_ip.get_address_in_network(
|
||||
config_cidr,
|
||||
hookenv.unit_get('private-address'))
|
||||
else:
|
||||
addr = ch_ip.get_relation_ip(
|
||||
os_ip.ADDRESS_MAP[net_type]['binding'])
|
||||
addresses.append(
|
||||
(addr, os_ip.resolve_address(endpoint_type=net_type)))
|
||||
return sorted(addresses)
|
||||
|
|
|
@ -564,13 +564,15 @@ class TestAPIConfigurationAdapter(unittest.TestCase):
|
|||
return resolved_addresses[endpoint_type]
|
||||
|
||||
with mock.patch.object(adapters.hookenv, 'config',
|
||||
new=lambda: test_config), \
|
||||
return_value=test_config), \
|
||||
mock.patch.object(adapters.hookenv, 'unit_get',
|
||||
return_value='thisunit'), \
|
||||
mock.patch.object(adapters.os_ip, 'resolve_address',
|
||||
new=_resolve_address), \
|
||||
mock.patch.object(adapters.ch_ip, 'get_address_in_network',
|
||||
new=lambda x, y: test_networks[x]):
|
||||
new=lambda x, y: test_networks[x]), \
|
||||
mock.patch.object(adapters.ch_ip, 'get_relation_ip',
|
||||
new=lambda x, y: test_networks[x]), \
|
||||
mock.patch.object(adapters.os_ip, 'resolve_address',
|
||||
new=_resolve_address):
|
||||
c = adapters.APIConfigurationAdapter()
|
||||
self.assertEqual(
|
||||
c.get_network_addresses(), [
|
||||
|
|
Loading…
Reference in New Issue