def set_ipset_config(self, obj, config): if obj.default: x = copy.copy(obj) x.import_config(config) x.path = ETC_FIREWALLD_IPSETS x.default = False self.add_ipset(x) ipset_writer(x) return x else: obj.import_config(config) ipset_writer(obj) return obj
def set_ipset_config(self, obj, conf): x = copy.copy(obj) if obj.builtin: x.path = config.ETC_FIREWALLD_IPSETS x.builtin = False if obj.path != x.path: x.default = False x.import_config(conf, self.get_all_io_objects_dict()) self.full_check_config({"ipsets": [x]}) self.add_ipset(x) ipset_writer(x) return x
def set_ipset_config(self, obj, conf): if obj.builtin: x = copy.copy(obj) x.import_config(conf) x.path = config.ETC_FIREWALLD_IPSETS x.builtin = False if obj.path != x.path: x.default = False self.add_ipset(x) ipset_writer(x) return x else: obj.import_config(conf) ipset_writer(obj) return obj
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
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
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