If apache is in place switch neutron server to listen on different port
This commit is contained in:
parent
5b23851202
commit
43c822e002
@ -5,6 +5,9 @@ from charmhelpers.core.hookenv import (
|
||||
relation_get,
|
||||
)
|
||||
from charmhelpers.contrib.openstack import context
|
||||
from charmhelpers.contrib.hahelpers.cluster import (
|
||||
determine_api_port,
|
||||
)
|
||||
|
||||
|
||||
class ApacheSSLContext(context.ApacheSSLContext):
|
||||
@ -54,10 +57,13 @@ class NeutronCCContext(context.NeutronContext):
|
||||
pass
|
||||
|
||||
def __call__(self):
|
||||
from neutron_api_utils import api_port
|
||||
ctxt = super(NeutronCCContext, self).__call__()
|
||||
ctxt['external_network'] = config('neutron-external-network')
|
||||
ctxt['verbose'] = config('verbose')
|
||||
ctxt['debug'] = config('debug')
|
||||
ctxt['neutron_bind_port'] = \
|
||||
determine_api_port(api_port('neutron-server'))
|
||||
for rid in relation_ids('neutron-api'):
|
||||
for unit in related_units(rid):
|
||||
ctxt['nova_url'] = relation_get(attribute='nova_url',
|
||||
|
@ -7,6 +7,7 @@ TO_PATCH = [
|
||||
'relation_ids',
|
||||
'related_units',
|
||||
'config',
|
||||
'determine_api_port',
|
||||
]
|
||||
|
||||
|
||||
@ -53,6 +54,8 @@ class NeutronAPIContextsTest(CharmTestCase):
|
||||
super(NeutronAPIContextsTest, self).setUp(context, TO_PATCH)
|
||||
self.relation_get.side_effect = self.test_relation.get
|
||||
self.config.side_effect = self.test_config.get
|
||||
self.api_port = 9696
|
||||
self.determine_api_port.return_value = self.api_port
|
||||
self.test_config.set('neutron-plugin', 'ovs')
|
||||
self.test_config.set('neutron-security-groups', True)
|
||||
self.test_config.set('debug', True)
|
||||
@ -70,11 +73,13 @@ class NeutronAPIContextsTest(CharmTestCase):
|
||||
ctxt_data = {
|
||||
'debug': True,
|
||||
'external_network': 'bob',
|
||||
'verbose': True
|
||||
'neutron_bind_port': self.api_port,
|
||||
'verbose': True,
|
||||
}
|
||||
with patch.object(napi_ctxt, '_ensure_packages'):
|
||||
self.assertEquals(ctxt_data, napi_ctxt())
|
||||
|
||||
#@patch.object(charmhelpers.contrib.hahelpers.cluster, 'determine_api_port')
|
||||
@patch.object(context.NeutronCCContext, 'network_manager')
|
||||
@patch.object(context.NeutronCCContext, 'plugin')
|
||||
def test_neutroncc_context_api_rel(self, plugin, nm):
|
||||
@ -85,6 +90,7 @@ class NeutronAPIContextsTest(CharmTestCase):
|
||||
self.test_relation.set({'nova_url': nova_url})
|
||||
napi_ctxt = context.NeutronCCContext()
|
||||
self.assertEquals(nova_url, napi_ctxt()['nova_url'])
|
||||
self.assertEquals(self.api_port, napi_ctxt()['neutron_bind_port'])
|
||||
|
||||
def test_neutroncc_context_manager(self):
|
||||
napi_ctxt = context.NeutronCCContext()
|
||||
|
@ -340,7 +340,8 @@ class NeutronAPIHooksTests(CharmTestCase):
|
||||
self.relation_ids.side_effect = self._fake_relids
|
||||
_id_rel_joined = self.patch('identity_joined')
|
||||
hooks.configure_https()
|
||||
self.check_call.assert_called_with(['a2ensite', 'openstack_https_frontend'])
|
||||
self.check_call.assert_called_with(['a2ensite',
|
||||
'openstack_https_frontend'])
|
||||
self.assertTrue(_id_rel_joined.called)
|
||||
|
||||
def test_configure_https_nohttps(self):
|
||||
@ -348,5 +349,6 @@ class NeutronAPIHooksTests(CharmTestCase):
|
||||
self.relation_ids.side_effect = self._fake_relids
|
||||
_id_rel_joined = self.patch('identity_joined')
|
||||
hooks.configure_https()
|
||||
self.check_call.assert_called_with(['a2dissite', 'openstack_https_frontend'])
|
||||
self.check_call.assert_called_with(['a2dissite',
|
||||
'openstack_https_frontend'])
|
||||
self.assertTrue(_id_rel_joined.called)
|
||||
|
Loading…
Reference in New Issue
Block a user