~openstack-charm-sync/charms/trusty/cinder-ceph/next

« back to all changes in this revision

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

  • Committer: Edward Hope-Morley
  • Date: 2015-09-16 01:07:56 UTC
  • mfrom: (40.1.7 trunk)
  • Revision ID: edward.hope-morley@canonical.com-20150916010756-6hqtjf3ogftq55p8
[gnuoy,r=hopem]

Update cinder-ceph broker code to scale-out bug.

Closes-Bug: #1453940

Show diffs side-by-side

added added

removed removed

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