Example #1
0
    def new_ipset(self, name, conf):
        if name in self._ipsets or name in self._builtin_ipsets:
            raise FirewallError(errors.NAME_CONFLICT,
                                "new_ipset(): '%s'" % name)

        x = IPSet()
        x.check_name(name)
        x.import_config(conf)
        x.name = name
        x.filename = "%s.xml" % name
        x.path = config.ETC_FIREWALLD_IPSETS
        # It is not possible to add a new one with a name of a buitin
        x.builtin = False
        x.default = True

        ipset_writer(x)
        self.add_ipset(x)
        return x
Example #2
0
    def new_ipset(self, name, conf):
        if name in self._ipsets or name in self._builtin_ipsets:
            raise FirewallError(errors.NAME_CONFLICT,
                                "new_ipset(): '%s'" % name)

        x = IPSet()
        x.check_name(name)
        x.import_config(conf)
        x.name = name
        x.filename = "%s.xml" % name
        x.path = config.ETC_FIREWALLD_IPSETS
        # It is not possible to add a new one with a name of a buitin
        x.builtin = False
        x.default = True

        ipset_writer(x)
        self.add_ipset(x)
        return x
Example #3
0
    def new_ipset(self, name, config):
        try:
            self.get_ipset(name)
        except:
            pass
        else:
            raise FirewallError(NAME_CONFLICT, "new_ipset(): '%s'" % name)

        x = IPSet()
        x.check_name(name)
        x.import_config(config)
        x.name = name
        x.filename = "%s.xml" % name
        x.path = ETC_FIREWALLD_IPSETS
        x.default = False

        ipset_writer(x)
        self.add_ipset(x)
        return x
Example #4
0
    def new_ipset(self, name, config):
        try:
            self.get_ipset(name)
        except:
            pass
        else:
            raise FirewallError(NAME_CONFLICT, "new_ipset(): '%s'" % name)

        x = IPSet()
        x.check_name(name)
        x.import_config(config)
        x.name = name
        x.filename = "%s.xml" % name
        x.path = ETC_FIREWALLD_IPSETS
        x.default = False

        ipset_writer(x)
        self.add_ipset(x)
        return x
Example #5
0
    def new_ipset(self, name, config):
        try:
            self.get_ipset(name)
        except:
            pass
        else:
            raise FirewallError(NAME_CONFLICT, "new_ipset(): '%s'" % name)

        x = IPSet()
        x.check_name(name)
        x.import_config(config)
        x.name = name
        x.filename = "%s.xml" % name
        x.path = ETC_FIREWALLD_IPSETS
        # It is not possible to add a new one with a name of a buitin
        x.default = True

        ipset_writer(x)
        self.add_ipset(x)
        return x