Remove implicit neutron prefix from pgsql relation
This commit is contained in:
parent
f8f036d7b1
commit
ed74b38c7f
|
@ -6,28 +6,12 @@ from charmhelpers.core.hookenv import (
|
|||
)
|
||||
from charmhelpers.contrib.openstack import context
|
||||
|
||||
class NeutronPostgresqlDBContext(context.PostgresqlDBContext):
|
||||
interfaces = ['pgsql-neutron-db']
|
||||
|
||||
def __init__(self):
|
||||
super(NeutronPostgresqlDBContext,
|
||||
self).__init__(config('database'))
|
||||
|
||||
class IdentityServiceContext(context.IdentityServiceContext):
|
||||
|
||||
def __call__(self):
|
||||
ctxt = super(IdentityServiceContext, self).__call__()
|
||||
if not ctxt:
|
||||
return
|
||||
|
||||
# the ec2 api needs to know the location of the keystone ec2
|
||||
# tokens endpoint, set in nova.conf
|
||||
ec2_tokens = '%s://%s:%s/v2.0/ec2tokens' % (
|
||||
ctxt['service_protocol'] or 'http',
|
||||
ctxt['service_host'],
|
||||
ctxt['service_port']
|
||||
)
|
||||
ctxt['keystone_ec2_url'] = ec2_tokens
|
||||
ctxt['region'] = config('region')
|
||||
return ctxt
|
||||
|
||||
|
@ -54,6 +38,8 @@ class NeutronCCContext(context.NeutronContext):
|
|||
for rid in relation_ids('neutron-api'):
|
||||
for unit in related_units(rid):
|
||||
ctxt['nova_url'] = relation_get(attribute='nova_url', rid=rid, unit=unit)
|
||||
if ctxt['nova_url']:
|
||||
return ctxt
|
||||
return ctxt
|
||||
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ def amqp_changed():
|
|||
@hooks.hook('shared-db-relation-joined')
|
||||
def db_joined():
|
||||
if is_relation_made('pgsql-nova-db') or \
|
||||
is_relation_made('pgsql-neutron-db'):
|
||||
is_relation_made('pgsql-db'):
|
||||
# error, postgresql is used
|
||||
e = ('Attempting to associate a mysql database when there is already '
|
||||
'associated a postgresql one')
|
||||
|
@ -109,7 +109,7 @@ def db_joined():
|
|||
neutron_hostname=unit_get('private-address'))
|
||||
|
||||
|
||||
@hooks.hook('pgsql-neutron-db-relation-joined')
|
||||
@hooks.hook('pgsql-db-relation-joined')
|
||||
def pgsql_neutron_db_joined():
|
||||
if is_relation_made('shared-db'):
|
||||
# raise error
|
||||
|
@ -129,7 +129,7 @@ def db_changed():
|
|||
return
|
||||
CONFIGS.write_all()
|
||||
|
||||
@hooks.hook('pgsql-neutron-db-relation-changed')
|
||||
@hooks.hook('pgsql-db-relation-changed')
|
||||
@restart_on_change(restart_map())
|
||||
def postgresql_neutron_db_changed():
|
||||
if network_manager() in ['neutron', 'quantum']:
|
||||
|
@ -164,7 +164,7 @@ def _auth_config():
|
|||
@hooks.hook('amqp-relation-broken',
|
||||
'identity-service-relation-broken',
|
||||
'shared-db-relation-broken',
|
||||
'pgsql-neutron-db-relation-broken')
|
||||
'pgsql-db-relation-broken')
|
||||
def relation_broken():
|
||||
CONFIGS.write_all()
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ BASE_RESOURCE_MAP = OrderedDict([
|
|||
user=config('database-user'),
|
||||
database=config('database'),
|
||||
ssl_dir=NEUTRON_CONF_DIR),
|
||||
neutron_api_context.NeutronPostgresqlDBContext(),
|
||||
context.PostgresqlDBContext(database=config('database')),
|
||||
neutron_api_context.IdentityServiceContext(),
|
||||
neutron_api_context.NeutronCCContext(),
|
||||
context.SyslogContext()],
|
||||
|
|
|
@ -15,7 +15,7 @@ provides:
|
|||
requires:
|
||||
shared-db:
|
||||
interface: mysql-shared
|
||||
pgsql-neutron-db:
|
||||
pgsql-db:
|
||||
interface: pgsql
|
||||
amqp:
|
||||
interface: rabbitmq
|
||||
|
|
Loading…
Reference in New Issue