~sdn-charmers/charms/trusty/contrail-configuration/trunk

« back to all changes in this revision

Viewing changes to hooks/contrail_configuration_hooks.py

  • Committer: Robert Ayres
  • Date: 2016-11-10 15:47:28 UTC
  • Revision ID: robert.ayres@canonical.com-20161110154728-y2o7t6srblhe5qzr
Add keystone services relation for contrail 3.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
192
192
        configure_control_network()
193
193
        configure_floating_ip_pools()
194
194
 
195
 
    settings = { "private-address": control_network_ip(),
196
 
                 "vip": config.get("vip") }
 
195
    ip = control_network_ip()
 
196
    vip = config.get("vip")
 
197
    settings = { "private-address": ip,
 
198
                 "vip": vip }
197
199
    for rid in relation_ids("contrail-api"):
198
200
        relation_set(relation_id=rid, relation_settings=settings)
199
201
    for rid in relation_ids("contrail-discovery"):
200
202
        relation_set(relation_id=rid, relation_settings=settings)
 
203
 
 
204
    region = config.get("region")
 
205
    url = "http://{}:8082".format(vip if vip else ip)
 
206
    for rid in relation_ids("identity-service"):
 
207
        relation_set(relation_id=rid,
 
208
                     region=region,
 
209
                     public_url=url,
 
210
                     internal_url=url,
 
211
                     admin_url=url)
 
212
 
201
213
    services = yaml.dump(http_services())
202
214
    for rid in relation_ids("http-services"):
203
215
        relation_set(relation_id=rid, services=services)
385
397
    if version_compare(CONTRAIL_VERSION, "3.0.2.0-34") >= 0:
386
398
        write_barbican_auth_config()
387
399
 
 
400
@hooks.hook("identity-service-relation-joined")
 
401
def identity_service_joined():
 
402
    vip = config.get("vip")
 
403
    url = "http://{}:8082".format(vip if vip else control_network_ip())
 
404
    relation_set(service="contrail-api",
 
405
                 region=config.get("region"),
 
406
                 public_url=url,
 
407
                 internal_url=url,
 
408
                 admin_url=url)
 
409
 
388
410
@hooks.hook()
389
411
def install():
390
412
    configure_installation_source(config["openstack-origin"])