Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 4
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
Exemplo n.º 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