Exemplo n.º 1
0
def parse_acbs_conf(tree_name):
    import configparser
    acbs_config = RawConfigParser()
    acbs_config._interpolation = configparser.ExtendedInterpolation()
    fp = open('/etc/acbs_forest.conf', 'rt')
    try:
        acbs_config.read_file(fp)
    except:
        return None
    try:
        tree_loc_dict = acbs_config[tree_name]
    except:
        print('[E] 404 - Tree not found: {}, defined trees: {}'.format(tree_name,
                                                                       arr2str(acbs_config.sections())))
        return None
    try:
        tree_loc = tree_loc_dict['location']
    except KeyError:
        print('[E] Malformed configuration file: missing `location` keyword')
        return None
    return tree_loc
Exemplo n.º 2
0
def parse_acbs_conf(tree_name):
    import configparser
    acbs_config = RawConfigParser()
    acbs_config._interpolation = configparser.ExtendedInterpolation()
    fp = open('/etc/acbs_forest.conf', 'rt')
    try:
        acbs_config.read_file(fp)
    except:
        return None
    try:
        tree_loc_dict = acbs_config[tree_name]
    except:
        print('[E] 404 - Tree not found: {}, defined trees: {}'.format(tree_name,
                                                                       arr2str(acbs_config.sections())))
        return None
    try:
        tree_loc = tree_loc_dict['location']
    except KeyError:
        print('[E] Malformed configuration file: missing `location` keyword')
        return None
    return tree_loc