def radosgw_relation(relid=None, unit=None): # Install radosgw for admin tools apt_install(packages=filter_installed_packages(['radosgw'])) if not unit: unit = remote_unit() # NOTE: radosgw needs some usage OSD storage, so defer key # provision until OSD units are detected. if ready(): log('mon cluster in quorum and osds related ' '- providing radosgw with keys') public_addr = get_public_addr() data = { 'fsid': config('fsid'), 'radosgw_key': ceph.get_radosgw_key(), 'auth': 'cephx', 'ceph-public-address': public_addr, } settings = relation_get(rid=relid, unit=unit) """Process broker request(s).""" if 'broker_req' in settings: rsp = process_requests(settings['broker_req']) unit_id = unit.replace('/', '-') unit_response_key = 'broker-rsp-' + unit_id data[unit_response_key] = rsp relation_set(relation_id=relid, relation_settings=data) else: log('FSID or admin key not provided, please configure them')
def radosgw_relation(relid=None, unit=None): # Install radosgw for admin tools apt_install(packages=filter_installed_packages(['radosgw'])) if not unit: unit = remote_unit() """Process broker request(s).""" if ceph.is_quorum(): settings = relation_get(rid=relid, unit=unit) if 'broker_req' in settings: if not ceph.is_leader(): log("Not leader - ignoring broker request", level=DEBUG) else: 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) else: log('mon cluster not in quorum - deferring key provision')
def radosgw_relation(relid=None, unit=None): # Install radosgw for admin tools apt_install(packages=filter_installed_packages(['radosgw'])) if not unit: unit = remote_unit() # NOTE: radosgw needs some usage OSD storage, so defer key # provision until OSD units are detected. if ready(): log('mon cluster in quorum and osds related ' '- providing radosgw with keys') public_addr = get_public_addr() data = { 'fsid': config('fsid'), 'radosgw_key': ceph.get_radosgw_key(), 'auth': 'cephx', 'ceph-public-address': public_addr, } settings = relation_get(rid=relid, unit=unit) """Process broker request(s).""" if 'broker_req' in settings: if ceph.is_leader(): rsp = process_requests(settings['broker_req']) unit_id = unit.replace('/', '-') unit_response_key = 'broker-rsp-' + unit_id data[unit_response_key] = rsp else: log("Not leader - ignoring broker request", level=DEBUG) relation_set(relation_id=relid, relation_settings=data) else: log('FSID or admin key not provided, please configure them')
def radosgw_relation(relid=None, unit=None): # Install radosgw for admin tools apt_install(packages=filter_installed_packages(['radosgw'])) if not unit: unit = remote_unit() # NOTE: radosgw needs some usage OSD storage, so defer key # provision until OSD units are detected. if ceph.is_quorum() and related_osds(): log('mon cluster in quorum and osds related ' '- 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 ceph.is_leader(): rsp = process_requests(settings['broker_req']) unit_id = unit.replace('/', '-') unit_response_key = 'broker-rsp-' + unit_id 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 or no osds - deferring key provision')
def notify_radosgws(): utils.juju_log('INFO', 'Begin notify_radosgws.') for relid in utils.relation_ids('radosgw'): utils.relation_set(radosgw_key=ceph.get_radosgw_key(), auth=utils.config_get('auth-supported'), rid=relid) utils.juju_log('INFO', 'End notify_radosgws.')
def notify_radosgws(): log('Begin notify_radosgws.') for relid in relation_ids('radosgw'): relation_set(relation_id=relid, radosgw_key=ceph.get_radosgw_key(), auth=config('auth-supported')) log('End notify_radosgws.')
def radosgw_relation(): log('Begin radosgw-relation hook.') # Install radosgw for admin tools apt_install(packages=filter_installed_packages(['radosgw'])) if ceph.is_quorum(): log('mon cluster in quorum - providing radosgw with keys') relation_set(radosgw_key=ceph.get_radosgw_key(), auth=config('auth-supported')) else: log('mon cluster not in quorum - deferring key provision') log('End radosgw-relation hook.')
def radosgw_relation(relid=None): # Install radosgw for admin tools apt_install(packages=filter_installed_packages(['radosgw'])) if ceph.is_quorum(): log('mon cluster in quorum - providing radosgw with keys') data = { 'fsid': leader_get('fsid'), 'radosgw_key': ceph.get_radosgw_key(), 'auth': config('auth-supported'), 'ceph-public-address': get_public_addr(), } relation_set(relation_id=relid, relation_settings=data) else: log('mon cluster not in quorum - deferring key provision')
def radosgw_relation(): utils.juju_log('INFO', 'Begin radosgw-relation hook.') utils.install('radosgw') # Install radosgw for admin tools if ceph.is_quorum(): utils.juju_log('INFO', 'mon cluster in quorum - \ providing radosgw with keys') utils.relation_set(radosgw_key=ceph.get_radosgw_key(), auth=utils.config_get('auth-supported')) else: utils.juju_log('INFO', 'mon cluster not in quorum - deferring key provision') utils.juju_log('INFO', 'End radosgw-relation hook.')