예제 #1
0
def test(**kwargs):
    net_conf, net_parse = parser.parse_conf(filename='dhcpd.conf', return_parsed=True)
    lease_conf = parser.parse_leases(filename='dhcpd.leases')
    nets = network_objects.build_networks(net_conf)
    leases = network_objects.build_leases(lease_conf)
    return {'PARSED_NETWORKS':net_conf, 
            'PARSED_BRACKETS':net_parse, 
            'PARSED_LEASES':lease_conf, 
            'NETWORKS':nets, 
            'LEASES':leases}
예제 #2
0
파일: loader.py 프로젝트: yhcting/cfgldr
def load_config(fconf, fverifier,
                confdict=None, verifierdict=None):
    """
    Load config file and returns corresponding 'dict' structure.
    :param fconf: (str) config file path
    :param fverifier: (str) verifier file path. None is allowed.
    :param confdict: (dict) That can be used as named-replacement-dict for conf
    :param verifierdict: (dict) That can be used as named-replacement-dict for
                         verifier
    :return: (section.Sect) root section
    """
    return parser.parse_conf(fconf, fverifier,
                             confdict, verifierdict)
예제 #3
0
def test(**kwargs):
    conf_file = kwargs.get('conf_file', 'dhcpd.conf')
    lease_file = kwargs.get('lease_file', 'dhcpd.leases')
    net_conf, net_parse = parser.parse_conf(filename=conf_file,
                                            return_parsed=True)
    lease_conf = parser.parse_leases(filename=lease_file)
    nets = network_objects.build_networks(net_conf)
    leases = network_objects.build_leases(lease_conf)
    return {
        'PARSED_NETWORKS': net_conf,
        'PARSED_BRACKETS': net_parse,
        'PARSED_LEASES': lease_conf,
        'NETWORKS': nets,
        'LEASES': leases
    }
예제 #4
0
파일: monitor.py 프로젝트: zhyueh/DBMonitor
    def load_conf(self):
        try:
            config_name = "monitor.conf"
            if len(sys.argv) > 1:
                config_name = sys.argv[1] + ".conf"

            conf_path = os.path.join(sys.path[0], "conf", config_name)
            logging.debug("config file path:" + conf_path)
            if os.path.exists(conf_path):
                self.conf = parser.parse_conf(conf_path)
            else:
                logging.critical("no config file name:" + config_name)
                sys.exit(1)
        except Exception,e:
            logging.critical('parse configure file failed {0}'.format(str(e)))
            sys.exit(1)
예제 #5
0
def do_parse():
    net_conf = parser.parse_conf()
    lease_conf = parser.parse_leases()
    nets = network_objects.build_networks(net_conf)
    network_objects.build_leases(lease_conf)
    return nets
예제 #6
0
def do_parse():
    net_conf = parser.parse_conf()
    lease_conf = parser.parse_leases()
    nets = network_objects.build_networks(net_conf)
    network_objects.build_leases(lease_conf)
    return nets