~joeborg/charms/trusty/contrail-configuration/rbac-switch

« back to all changes in this revision

Viewing changes to hooks/contrail_configuration_utils.py

  • Committer: Ante Karamatic
  • Date: 2017-01-31 12:51:09 UTC
  • mto: This revision was merged to the branch mainline in revision 65.
  • Revision ID: ante.karamatic@canonical.com-20170131125109-qwjbg96c10i2iixk
SSL support for contrail-configuration

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
import json
17
17
import urllib2
18
18
 
 
19
from charmhelpers.contrib.hahelpers.apache import (
 
20
    get_ca_cert,
 
21
    install_ca_cert
 
22
)
 
23
 
19
24
from charmhelpers.contrib.network.ip import get_address_in_network
20
25
 
21
26
from charmhelpers.core.hookenv import (
311
316
def identity_admin_ctx():
312
317
    ctxs = [ { "auth_host": gethostbyname(hostname),
313
318
               "auth_port": relation_get("service_port", unit, rid),
 
319
               "auth_protocol": relation_get("service_protocol", unit, rid),
314
320
               "admin_user": relation_get("service_username", unit, rid),
315
321
               "admin_password": relation_get("service_password", unit, rid),
316
322
               "admin_tenant_name": relation_get("service_tenant_name", unit, rid),
319
325
             for unit, hostname in
320
326
             ((unit, relation_get("service_hostname", unit, rid)) for unit in related_units(rid))
321
327
             if hostname ]
 
328
    install_certificates()
322
329
    return ctxs[0] if ctxs else {}
323
330
 
 
331
def install_certificates():
 
332
    CAcert = get_ca_cert()
 
333
    if CAcert is not None:
 
334
        install_ca_cert(CAcert)
 
335
 
324
336
def is_container():
325
337
    """Return boolean determining if inside container"""
326
338
    try: