Ejemplo n.º 1
0
    def set_helper_config(self, obj, conf):
        x = copy.copy(obj)
        if obj.builtin:
            x.path = config.ETC_FIREWALLD_HELPERS
            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({"helpers": [x]})
        self.add_helper(x)
        helper_writer(x)
        return x
Ejemplo n.º 2
0
 def set_helper_config(self, obj, conf):
     if obj.builtin:
         x = copy.copy(obj)
         x.import_config(conf)
         x.path = config.ETC_FIREWALLD_HELPERS
         x.builtin = False
         if obj.path != x.path:
             x.default = False
         self.add_helper(x)
         helper_writer(x)
         return x
     else:
         obj.import_config(conf)
         helper_writer(obj)
         return obj
Ejemplo n.º 3
0
 def set_helper_config(self, obj, conf):
     if obj.builtin:
         x = copy.copy(obj)
         x.import_config(conf)
         x.path = config.ETC_FIREWALLD_HELPERS
         x.builtin = False
         if obj.path != x.path:
             x.default = False
         self.add_helper(x)
         helper_writer(x)
         return x
     else:
         obj.import_config(conf)
         helper_writer(obj)
         return obj
Ejemplo n.º 4
0
    def new_helper(self, name, conf):
        if name in self._helpers or name in self._builtin_helpers:
            raise FirewallError(errors.NAME_CONFLICT,
                                "new_helper(): '%s'" % name)

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

        helper_writer(x)
        self.add_helper(x)
        return x
Ejemplo n.º 5
0
    def new_helper(self, name, conf):
        if name in self._helpers or name in self._builtin_helpers:
            raise FirewallError(errors.NAME_CONFLICT,
                                "new_helper(): '%s'" % name)

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

        helper_writer(x)
        self.add_helper(x)
        return x