예제 #1
0
def test_PConfigHelper_init():
    with pytest.raises(ValueUndefinedError):
        PConfigHelper(None)

    with pytest.raises(PlenumValueError) as excinfo:
        PConfigHelper({}, chroot=".")
    assert re.search(r"chroot.*expected: starts with '/'", str(excinfo.value))
예제 #2
0
def prepare_directory_for_replay(node_basedirpath, replay_dir, config):
    src_etc_dir = PConfigHelper._chroot_if_needed(config.GENERAL_CONFIG_DIR,
                                                  node_basedirpath)
    src_var_dir = PConfigHelper._chroot_if_needed(config.GENESIS_DIR,
                                                  node_basedirpath)
    trg_etc_dir = PConfigHelper._chroot_if_needed(config.GENERAL_CONFIG_DIR,
                                                  replay_dir)
    trg_var_dir = PConfigHelper._chroot_if_needed(config.GENESIS_DIR,
                                                  replay_dir)

    os.makedirs(trg_var_dir, exist_ok=True)
    shutil.copytree(src_etc_dir, trg_etc_dir)
    for file in os.listdir(src_var_dir):
        if file.endswith('.json') or file.endswith('_genesis'):
            shutil.copy(os.path.join(src_var_dir, file), trg_var_dir)

    shutil.copytree(
        PConfigHelper._chroot_if_needed(config.KEYS_DIR, node_basedirpath),
        PConfigHelper._chroot_if_needed(config.KEYS_DIR, replay_dir))
    shutil.copytree(
        PConfigHelper._chroot_if_needed(config.PLUGINS_DIR, node_basedirpath),
        PConfigHelper._chroot_if_needed(config.PLUGINS_DIR, replay_dir))
예제 #3
0
def prepare_directory_for_replay(node_basedirpath, replay_dir, config):
    src_etc_dir = PConfigHelper._chroot_if_needed(config.GENERAL_CONFIG_DIR,
                                                  node_basedirpath)
    src_var_dir = PConfigHelper._chroot_if_needed(config.GENESIS_DIR,
                                                  node_basedirpath)
    trg_etc_dir = PConfigHelper._chroot_if_needed(config.GENERAL_CONFIG_DIR,
                                                  replay_dir)
    trg_var_dir = PConfigHelper._chroot_if_needed(config.GENESIS_DIR,
                                                  replay_dir)

    os.makedirs(trg_var_dir, exist_ok=True)
    shutil.copytree(src_etc_dir, trg_etc_dir)
    for file in os.listdir(src_var_dir):
        if file.endswith('.json') or file.endswith('_genesis'):
            shutil.copy(os.path.join(src_var_dir, file), trg_var_dir)

    shutil.copytree(PConfigHelper._chroot_if_needed(config.KEYS_DIR,
                                                    node_basedirpath),
                    PConfigHelper._chroot_if_needed(config.KEYS_DIR,
                                                    replay_dir))
    shutil.copytree(
        PConfigHelper._chroot_if_needed(config.PLUGINS_DIR, node_basedirpath),
        PConfigHelper._chroot_if_needed(config.PLUGINS_DIR,
                                        replay_dir))