def assert_ifcfg_has_items(ifname, expected_items): ifcfg = ShellVarFile("/etc/sysconfig/network-scripts/ifcfg-" + ifname) ifcfg_items = sorted(ifcfg.get_dict().items()) logging.info("ifcfg : %s" % ifname) logging.info("expect: %s" % expected_items) logging.info("got : %s" % ifcfg_items) assert ifcfg_items == expected_items
def ifcfg_has_items(ifname, expected_items): """Check if the items in an ifcfg file are equal the expected_items """ ifcfg = ShellVarFile(ifcfgfilename(ifname)) ifcfg_items = sorted(ifcfg.get_dict().items()) logging.info("ifcfg : %s" % ifname) logging.info("expect: %s" % expected_items) logging.info("got : %s" % ifcfg_items) return ifcfg_items == expected_items