def emit_cephconf(): # Ensure ceph directory actually exists if not os.path.exists('/etc/ceph'): os.makedirs('/etc/ceph') cephcontext = { 'auth_supported': get_auth() or 'none', 'mon_hosts': ' '.join(get_mon_hosts()), 'hostname': utils.get_unit_hostname(), 'version': ceph.get_ceph_version('radosgw') } # Check to ensure that correct version of ceph is # in use if ceph.get_ceph_version('radosgw') >= "0.55": # Add keystone configuration if found ks_conf = get_keystone_conf() if ks_conf: cephcontext.update(ks_conf) with open('/etc/ceph/ceph.conf', 'w') as cephconf: cephconf.write(utils.render_template('ceph.conf', cephcontext))
def identity_joined(relid=None): if ceph.get_ceph_version('radosgw') < "0.55": utils.juju_log('ERROR', 'Integration with keystone requires ceph >= 0.55') sys.exit(1) hostname = utils.unit_get('private-address') admin_url = 'http://{}:80/swift'.format(hostname) internal_url = public_url = '{}/v1'.format(admin_url) utils.relation_set(service='swift', region=utils.config_get('region'), public_url=public_url, internal_url=internal_url, admin_url=admin_url, requested_roles=utils.config_get('operator-roles'), rid=relid)
def emit_cephconf(): cephcontext = { 'auth_supported': config('auth-supported'), 'mon_hosts': ' '.join(get_mon_hosts()), 'fsid': config('fsid'), 'version': ceph.get_ceph_version() } # Install ceph.conf as an alternative to support # co-existence with other charms that write this file charm_ceph_conf = "/var/lib/charm/{}/ceph.conf".format(service_name()) mkdir(os.path.dirname(charm_ceph_conf)) with open(charm_ceph_conf, 'w') as cephconf: cephconf.write(render_template('ceph.conf', cephcontext)) install_alternative('ceph.conf', '/etc/ceph/ceph.conf', charm_ceph_conf, 100)
def install_upstart_scripts(): # Only install upstart configurations for older versions if ceph.get_ceph_version() < "0.55.1": for x in glob.glob('files/upstart/*.conf'): shutil.copy(x, '/etc/init/')