Drop use of resolve_address
The shared secret context makes use of 'resolve_address' to resolve the local_ip address of the unit; the resulting value is not actually used in the metadata_agent.ini template and breaks under Juju 2.0, where resolve_address attempts to use network-get to resolve the public endpoint of the service using extra bindings (which are not relevant for this charm). Drop use of resolve address and tidy templates; the default 127.0.0.1 address is fine for accessing the Nova Metadata service from the Neutron Metadata agent proxy. Change-Id: I03fc6d1c7c8ca832b02a7df5b1666c04aaecc589 Close-Bug: 1580271
This commit is contained in:
parent
f22e739c2c
commit
4cfdc89c56
@ -10,7 +10,6 @@ from charmhelpers.core.hookenv import (
|
||||
unit_get,
|
||||
network_get_primary_address,
|
||||
)
|
||||
from charmhelpers.contrib.openstack.ip import resolve_address
|
||||
from charmhelpers.contrib.openstack import context
|
||||
from charmhelpers.contrib.openstack.utils import get_host_ip
|
||||
from charmhelpers.contrib.network.ip import get_address_in_network
|
||||
@ -244,7 +243,6 @@ class SharedSecretContext(OSContextGenerator):
|
||||
config('enable-local-dhcp-and-metadata'):
|
||||
ctxt = {
|
||||
'shared_secret': get_shared_secret(),
|
||||
'local_ip': resolve_address(),
|
||||
}
|
||||
else:
|
||||
ctxt = {}
|
||||
|
@ -13,8 +13,6 @@ admin_user = {{ admin_user }}
|
||||
admin_password = {{ admin_password }}
|
||||
root_helper = sudo neutron-rootwrap /etc/neutron/rootwrap.conf
|
||||
state_path = /var/lib/neutron
|
||||
# Gateway runs a metadata API server locally
|
||||
#nova_metadata_ip = {{ local_ip }}
|
||||
nova_metadata_port = 8775
|
||||
metadata_proxy_shared_secret = {{ shared_secret }}
|
||||
cache_url = memory://?default_ttl=5
|
||||
|
@ -13,8 +13,6 @@ admin_user = {{ admin_user }}
|
||||
admin_password = {{ admin_password }}
|
||||
root_helper = sudo neutron-rootwrap /etc/neutron/rootwrap.conf
|
||||
state_path = /var/lib/neutron
|
||||
# Gateway runs a metadata API server locally
|
||||
#nova_metadata_ip = {{ local_ip }}
|
||||
nova_metadata_port = 8775
|
||||
metadata_proxy_shared_secret = {{ shared_secret }}
|
||||
cache_url = memory://?default_ttl=5
|
||||
|
@ -6,7 +6,6 @@ import neutron_ovs_context as context
|
||||
import charmhelpers
|
||||
|
||||
TO_PATCH = [
|
||||
'resolve_address',
|
||||
'config',
|
||||
'unit_get',
|
||||
'get_host_ip',
|
||||
@ -299,10 +298,8 @@ class SharedSecretContext(CharmTestCase):
|
||||
_NeutronAPIContext):
|
||||
_NeutronAPIContext.side_effect = fake_context({'enable_dvr': True})
|
||||
_shared_secret.return_value = 'secret_thing'
|
||||
self.resolve_address.return_value = '10.0.0.10'
|
||||
self.assertEquals(context.SharedSecretContext()(),
|
||||
{'shared_secret': 'secret_thing',
|
||||
'local_ip': '10.0.0.10'})
|
||||
{'shared_secret': 'secret_thing'})
|
||||
|
||||
@patch.object(context, 'NeutronAPIContext')
|
||||
@patch.object(context, 'get_shared_secret')
|
||||
@ -310,7 +307,6 @@ class SharedSecretContext(CharmTestCase):
|
||||
_NeutronAPIContext):
|
||||
_NeutronAPIContext.side_effect = fake_context({'enable_dvr': False})
|
||||
_shared_secret.return_value = 'secret_thing'
|
||||
self.resolve_address.return_value = '10.0.0.10'
|
||||
self.assertEquals(context.SharedSecretContext()(), {})
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user