~tribaal/charms/trusty/keystone/update-stable-charm-helpers

« back to all changes in this revision

Viewing changes to hooks/charmhelpers/contrib/openstack/context.py

  • Committer: Christopher Glass
  • Date: 2015-09-18 14:18:36 UTC
  • Revision ID: christopher.glass@canonical.com-20150918141836-1l4rktnv4rdff5lt
Updated charm-helpers again.

Show diffs side-by-side

added added

removed removed

Lines of Context:
483
483
 
484
484
        log('Generating template context for ceph', level=DEBUG)
485
485
        mon_hosts = []
486
 
        auth = None
487
 
        key = None
488
 
        use_syslog = str(config('use-syslog')).lower()
 
486
        ctxt = {
 
487
            'use_syslog': str(config('use-syslog')).lower()
 
488
        }
489
489
        for rid in relation_ids('ceph'):
490
490
            for unit in related_units(rid):
491
 
                auth = relation_get('auth', rid=rid, unit=unit)
492
 
                key = relation_get('key', rid=rid, unit=unit)
 
491
                if not ctxt.get('auth'):
 
492
                    ctxt['auth'] = relation_get('auth', rid=rid, unit=unit)
 
493
                if not ctxt.get('key'):
 
494
                    ctxt['key'] = relation_get('key', rid=rid, unit=unit)
493
495
                ceph_pub_addr = relation_get('ceph-public-address', rid=rid,
494
496
                                             unit=unit)
495
497
                unit_priv_addr = relation_get('private-address', rid=rid,
498
500
                ceph_addr = format_ipv6_addr(ceph_addr) or ceph_addr
499
501
                mon_hosts.append(ceph_addr)
500
502
 
501
 
        ctxt = {'mon_hosts': ' '.join(sorted(mon_hosts)),
502
 
                'auth': auth,
503
 
                'key': key,
504
 
                'use_syslog': use_syslog}
 
503
        ctxt['mon_hosts'] = ' '.join(sorted(mon_hosts))
505
504
 
506
505
        if not os.path.isdir('/etc/ceph'):
507
506
            os.mkdir('/etc/ceph')