def emit_cephconf(): # 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), owner=ceph.ceph_user(), group=ceph.ceph_user()) render('ceph.conf', charm_ceph_conf, get_ceph_context(), perms=0o644) install_alternative('ceph.conf', '/etc/ceph/ceph.conf', charm_ceph_conf, 100)
def emit_cephconf(upgrading=False): # 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), owner=ceph.ceph_user(), group=ceph.ceph_user()) context = get_ceph_context(upgrading) write_file(charm_ceph_conf, render_template('ceph.conf', context), ceph.ceph_user(), ceph.ceph_user(), 0o644) install_alternative('ceph.conf', '/etc/ceph/ceph.conf', charm_ceph_conf, 90)
def emit_cephconf(upgrading=False): # 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), owner=ceph.ceph_user(), group=ceph.ceph_user()) with open(charm_ceph_conf, 'w') as cephconf: context = get_ceph_context(upgrading) cephconf.write(render_template('ceph.conf', context)) install_alternative('ceph.conf', '/etc/ceph/ceph.conf', charm_ceph_conf, 90)
def import_osd_upgrade_key(key): """ Ensure that the osd-upgrade keyring is setup. :param key: The cephx key to add to the upgrade keyring :type key: str :raises: subprocess.CalledProcessError""" if not os.path.exists(_upgrade_keyring): cmd = [ "sudo", "-u", ceph.ceph_user(), 'ceph-authtool', _upgrade_keyring, '--create-keyring', '--name=client.osd-upgrade', '--add-key={}'.format(key) ] subprocess.check_call(cmd)