Ensure all units provide ceph-public-addr

radosgw relation was only providing information
when executed by a leader unit. This patch ensures
that the minimum info is provided regardless.

Change-Id: I2f841933f70847fb1bddc94f5ae525f5588021c2
Closes-Bug: 1570823
This commit is contained in:
Edward Hope-Morley 2016-04-15 13:29:52 +01:00
parent 6b7bbdf032
commit 99b2a7c2e3
1 changed files with 17 additions and 14 deletions

View File

@ -515,26 +515,29 @@ def radosgw_relation(relid=None, unit=None):
apt_install(packages=filter_installed_packages(['radosgw']))
if not unit:
unit = remote_unit()
"""Process broker request(s)."""
if ceph.is_quorum():
log('mon cluster in quorum - providing radosgw with keys')
public_addr = get_public_addr()
data = {
'fsid': leader_get('fsid'),
'radosgw_key': ceph.get_radosgw_key(),
'auth': config('auth-supported'),
'ceph-public-address': public_addr,
}
settings = relation_get(rid=relid, unit=unit)
"""Process broker request(s)."""
if 'broker_req' in settings:
if not ceph.is_leader():
log("Not leader - ignoring broker request", level=DEBUG)
else:
if ceph.is_leader():
rsp = process_requests(settings['broker_req'])
unit_id = unit.replace('/', '-')
unit_response_key = 'broker-rsp-' + unit_id
log('mon cluster in quorum - providing radosgw with keys')
public_addr = get_public_addr()
data = {
'fsid': leader_get('fsid'),
'radosgw_key': ceph.get_radosgw_key(),
'auth': config('auth-supported'),
'ceph-public-address': public_addr,
unit_response_key: rsp,
}
relation_set(relation_id=relid, relation_settings=data)
data[unit_response_key] = rsp
else:
log("Not leader - ignoring broker request", level=DEBUG)
relation_set(relation_id=relid, relation_settings=data)
else:
log('mon cluster not in quorum - deferring key provision')