示例#1
0
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
示例#2
0
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
示例#3
0
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
示例#4
0
文件: network.py 项目: oVirt/Node
        def write(self):
            """Write a ifcfg file from the cfg
            """

            data = {}
            for k in self.cfg._keys:
                data[k.upper()] = self.cfg.__dict__.get(k)

            ShellVarFile.write(self, data, True)

            pcfg = fs.Config()
            if pcfg.is_enabled():
                pcfg.persist(self.filename)

            return data
示例#5
0
        def write(self):
            """Write a ifcfg file from the cfg
            """

            data = {}
            for k in self.cfg._keys:
                data[k.upper()] = self.cfg.__dict__.get(k)

            ShellVarFile.write(self, data, True)

            pcfg = fs.Config()
            if pcfg.is_enabled():
                pcfg.persist(self.filename)

            return data