Exemplo n.º 1
0
def get_fault_tolerance_config(section, key):
    flag = 0
    logging.debug(caliper_path.config_files.config_dir)
    if caliper_path.judge_caliper_installed():
        cfg_file = os.path.join('/etc', 'caliper', 'config',
                                'execution_contl.cfg')
    else:
        cfg_file = os.path.join(caliper_path.config_files.config_dir,
                                'execution_contl.cfg')
    try:
        tolerence_cfg = BaseCfg(cfg_file)
        value = tolerence_cfg.get_value(section, key)
    except Exception:
        raise
    else:
        if (value.startswith("True") or value.startswith("true")):
            flag = 1
        elif (value.startswith("False") or value.startswith('false')):
            flag = 0
        elif value == '':
            flag = 1
        else:
            logging.info("Wrong configuration in config/execution_contl.cfg")
            flag = 0
        return flag
Exemplo n.º 2
0
def get_config_value(config_name, section, key):
    cfg_file = os.path.join(caliper_path.config_files.config_dir, config_name)
    try:
        cfg = BaseCfg(cfg_file)
        value = cfg.get_value(section, key)
    except Exception:
        raise
    else:
        return value
Exemplo n.º 3
0
def get_config_value(config_name, section, key):
    cfg_file = os.path.join(caliper_path.config_files.config_dir, config_name)
    try:
        cfg = BaseCfg(cfg_file)
        value = cfg.get_value(section, key)
    except Exception:
        raise
    else:
        return value
Exemplo n.º 4
0
def get_fault_tolerance_config(section, key):
    flag = 0
    logging.debug(caliper_path.config_files.config_dir)
    cfg_file = os.path.join(caliper_path.config_files.config_dir,
                                    'execution_contl.cfg')
    try:
        tolerence_cfg = BaseCfg(cfg_file)
        value = tolerence_cfg.get_value(section, key)
    except Exception:
        raise
    else:
        if (value.startswith("True") or value.startswith("true")):
            flag = 1
        elif (value.startswith("False") or value.startswith('false')):
            flag = 0
        elif value == '':
            flag = 1
        else:
            logging.info("Wrong configuration in config/execution_contl.cfg")
            flag = 0
        return flag