コード例 #1
0
ファイル: netconfig.py プロジェクト: aloughlam/lnst
def prepare_netconfig(machine_file, config_file):
    tree_init = XmlDomTreeInit()
    data = prepare_machine_config(machine_file)

    dom = tree_init.parse_file(config_file)
    config_dom = dom.getElementsByTagName("netconfig")[0]

    config_parse = NetConfigParse()
    config_parse.disable_events()
    config_parse.set_recipe(data)
    config_parse.set_machine(0, data)
    config_parse.parse(config_dom)

    netconfig = NetConfig()
    for key, entry in data["netconfig"].iteritems():
        netconfig.add_interface_config(key, entry)

    return netconfig
コード例 #2
0
def prepare_netconfig(machine_file, config_file):
    tree_init = XmlDomTreeInit()
    data = prepare_machine_config(machine_file)

    dom = tree_init.parse_file(config_file)
    config_dom = dom.getElementsByTagName("netconfig")[0]

    config_parse = NetConfigParse()
    config_parse.disable_events()
    config_parse.set_recipe(data)
    config_parse.set_machine(0, data)
    config_parse.parse(config_dom)

    netconfig = NetConfig()
    for key, entry in data["netconfig"].iteritems():
        netconfig.add_interface_config(key, entry)

    return netconfig