def get_keys_from_leader(keys, overwrite_local=False):
    '\n    Gets the broadcasted keys from the leader and stores them in\n    the corresponding files.\n\n    Args:\n        keys: list of keys. Keys are actually files on the FS.\n\n    Returns: True if all key were fetched, False if not.\n\n    '
    os.makedirs('/root/cdk', exist_ok=True)
    for k in keys:
        if ((not os.path.exists(k)) or overwrite_local):
            contents = charms.leadership.leader_get(k)
            if (contents is None):
                msg = 'Waiting on leaders crypto keys.'
                hookenv.status_set('waiting', msg)
                hookenv.log('Missing content for file {}'.format(k))
                return False
            with open(k, 'w+') as fp:
                fp.write(contents)
    return True
Gets the broadcasted keys from the leader and stores them in
the corresponding files.

Args:
    keys: list of keys. Keys are actually files on the FS.

Returns: True if all key were fetched, False if not.
def get_keys_from_leader(keys, overwrite_local=False):
    '\n    Gets the broadcasted keys from the leader and stores them in\n    the corresponding files.\n\n    Args:\n        keys: list of keys. Keys are actually files on the FS.\n\n    Returns: True if all key were fetched, False if not.\n\n    '
    os.makedirs('/root/cdk', exist_ok=True)
    for k in keys:
        if ((not os.path.exists(k)) or overwrite_local):
            contents = charms.leadership.leader_get(k)
            if (contents is None):
                msg = 'Waiting on leaders crypto keys.'
                hookenv.status_set('waiting', msg)
                hookenv.log('Missing content for file {}'.format(k))
                return False
            with open(k, 'w+') as fp:
                fp.write(contents)
    return True