[gnuoy,r=jamespage] Reassert that neutron-api is the endpoint for the neutron-api service when joining with the cloud-controller incase it has registered the endpoint

This commit is contained in:
Liam Young 2014-09-30 09:25:00 +01:00
commit 8db30128a7
1 changed files with 7 additions and 4 deletions

View File

@ -1,6 +1,7 @@
#!/usr/bin/python
import sys
import uuid
from subprocess import check_call
from charmhelpers.core.hookenv import (
@ -208,7 +209,7 @@ def relation_broken():
@hooks.hook('identity-service-relation-joined')
def identity_joined(rid=None):
def identity_joined(rid=None, relation_trigger=False):
public_url = '{}:{}'.format(canonical_url(CONFIGS, PUBLIC),
api_port('neutron-server'))
admin_url = '{}:{}'.format(canonical_url(CONFIGS, ADMIN),
@ -216,14 +217,16 @@ def identity_joined(rid=None):
internal_url = '{}:{}'.format(canonical_url(CONFIGS, INTERNAL),
api_port('neutron-server')
)
endpoints = {
rel_settings = {
'quantum_service': 'quantum',
'quantum_region': config('region'),
'quantum_public_url': public_url,
'quantum_admin_url': admin_url,
'quantum_internal_url': internal_url,
}
relation_set(relation_id=rid, relation_settings=endpoints)
if relation_trigger:
rel_settings['relation_trigger'] = str(uuid.uuid4())
relation_set(relation_id=rid, relation_settings=rel_settings)
@hooks.hook('identity-service-relation-changed')
@ -254,7 +257,7 @@ def neutron_api_relation_joined(rid=None):
# Nova-cc may have grabbed the quantum endpoint so kick identity-service
# relation to register that its here
for r_id in relation_ids('identity-service'):
identity_joined(rid=r_id)
identity_joined(rid=r_id, relation_trigger=True)
@hooks.hook('neutron-api-relation-changed')