コード例 #1
0
ファイル: tests.py プロジェクト: nocarryr/node_mapper
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
ファイル: tests.py プロジェクト: nocarryr/dhcpd-stats
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
ファイル: log_stats.py プロジェクト: nocarryr/dhcpd-stats
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