Example #1
0
def generate_config(url: str, path_to_cdf: str) -> None:
    conf_dir = '/var/lib/hare'
    path = os.getenv('PATH')
    if path:
        path += os.pathsep + '/opt/seagate/cortx/hare/bin/'
    python_path = os.pathsep.join(sys.path)
    cmd = ['cfgen', '-o', conf_dir, path_to_cdf]
    execute(cmd, env={'PYTHONPATH': python_path, 'PATH': path})

    conf = ConfStoreProvider(url)
    hostname = conf.get_hostname()
    save(f'{conf_dir}/node-name', hostname)
Example #2
0
def all_services_started(url: str, nr_svcs: int) -> bool:
    conf = ConfStoreProvider(url)
    hostname = conf.get_hostname()
    kv = KVAdapter()
    status_data = kv.kv_get(f'{hostname}/processes', recurse=True)
    statuses = []
    for val in status_data:
        state = val['Value']
        statuses.append(json.loads(state.decode('utf8'))['state'])
    started = [status == 'M0_CONF_HA_PROCESS_STARTED' for status in statuses]
    if len(started) != nr_svcs:
        return False
    return all(started)