def set_icmptype_config(self, obj, config): if obj.default: x = copy.copy(obj) x.import_config(config) x.path = ETC_FIREWALLD_ICMPTYPES x.default = False self.add_icmptype(x) icmptype_writer(x) return x else: obj.import_config(config) icmptype_writer(obj) return obj
def set_icmptype_config(self, obj, config): if obj.default: x = copy.copy(obj) x.import_config(config) x.path = ETC_FIREWALLD_ICMPTYPES x.default = False self.add_icmptype(x) icmptype_writer(x) return x else: obj.import_config(config) icmptype_writer(obj) return obj
def set_icmptype_config(self, obj, conf): x = copy.copy(obj) if obj.builtin: x.path = config.ETC_FIREWALLD_ICMPTYPES 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({"icmptypes": [x]}) self.add_icmptype(x) icmptype_writer(x) return x
def set_icmptype_config(self, obj, conf): if obj.builtin: x = copy.copy(obj) x.import_config(conf) x.path = config.ETC_FIREWALLD_ICMPTYPES x.builtin = False if obj.path != x.path: x.default = False self.add_icmptype(x) icmptype_writer(x) return x else: obj.import_config(conf) icmptype_writer(obj) return obj
def set_icmptype_config(self, obj, conf): if obj.builtin: x = copy.copy(obj) x.import_config(conf) x.path = config.ETC_FIREWALLD_ICMPTYPES x.builtin = False if obj.path != x.path: x.default = False self.add_icmptype(x) icmptype_writer(x) return x else: obj.import_config(conf) icmptype_writer(obj) return obj
def new_icmptype(self, name, conf): if name in self._icmptypes or name in self._builtin_icmptypes: raise FirewallError(errors.NAME_CONFLICT, "new_icmptype(): '%s'" % name) x = IcmpType() x.check_name(name) x.import_config(conf) x.name = name x.filename = "%s.xml" % name x.path = config.ETC_FIREWALLD_ICMPTYPES # It is not possible to add a new one with a name of a buitin x.builtin = False x.default = True icmptype_writer(x) self.add_icmptype(x) return x
def new_icmptype(self, name, conf): if name in self._icmptypes: raise FirewallError(errors.NAME_CONFLICT, "new_icmptype(): '%s'" % name) x = IcmpType() x.check_name(name) x.import_config(conf) x.name = name x.filename = "%s.xml" % name x.path = config.ETC_FIREWALLD_ICMPTYPES # It is not possible to add a new one with a name of a buitin x.builtin = False x.default = True icmptype_writer(x) self.add_icmptype(x) return x
def new_icmptype(self, name, config): try: self.get_icmptype(name) except: pass else: raise FirewallError(NAME_CONFLICT, name) x = IcmpType() x.check_name(name) x.import_config(config) x.name = name x.filename = "%s.xml" % name x.path = ETC_FIREWALLD_ICMPTYPES x.default = False icmptype_writer(x) self.add_icmptype(x) return x
def new_icmptype(self, name, config): try: self.get_icmptype(name) except: pass else: raise FirewallError(NAME_CONFLICT, "new_icmptype(): '%s'" % name) x = IcmpType() x.check_name(name) x.import_config(config) x.name = name x.filename = "%s.xml" % name x.path = ETC_FIREWALLD_ICMPTYPES x.default = False icmptype_writer(x) self.add_icmptype(x) return x