def createService(desc, name, svcpp):
	svc = fcisvc.Service()
	svc.description = desc
	svc.short = name
	svc.name = name
	svc.ports = svcpp
	fcisvc.service_writer(svc, '/usr/lib/firewalld/services')
Example #2
0
 def set_service_config(self, obj, config):
     if obj.default:
         x = copy.copy(obj)
         x.import_config(config)
         x.path = ETC_FIREWALLD_SERVICES
         x.default = False
         self.add_service(x)
         service_writer(x)
         return x
     else:
         obj.import_config(config)
         service_writer(obj)
         return obj
Example #3
0
 def set_service_config(self, obj, config):
     if obj.default:
         x = copy.copy(obj)
         x.import_config(config)
         x.path = ETC_FIREWALLD_SERVICES
         x.default = False
         self.add_service(x)
         service_writer(x)
         return x
     else:
         obj.import_config(config)
         service_writer(obj)
         return obj
Example #4
0
    def set_service_config_dict(self, obj, conf):
        x = copy.copy(obj)
        if obj.builtin:
            x.path = config.ETC_FIREWALLD_SERVICES
            x.builtin = False
            if obj.path != x.path:
                x.default = False

        x.import_config_dict(conf, self.get_all_io_objects_dict())
        self.full_check_config({"services": [x]})
        self.add_service(x)
        service_writer(x)
        return x
Example #5
0
 def set_service_config(self, obj, conf):
     if obj.builtin:
         x = copy.copy(obj)
         x.import_config(conf)
         x.path = config.ETC_FIREWALLD_SERVICES
         x.builtin = False
         if obj.path != x.path:
             x.default = False
         self.add_service(x)
         service_writer(x)
         return x
     else:
         obj.import_config(conf)
         service_writer(obj)
         return obj
Example #6
0
 def set_service_config(self, obj, conf):
     if obj.builtin:
         x = copy.copy(obj)
         x.import_config(conf)
         x.path = config.ETC_FIREWALLD_SERVICES
         x.builtin = False
         if obj.path != x.path:
             x.default = False
         self.add_service(x)
         service_writer(x)
         return x
     else:
         obj.import_config(conf)
         service_writer(obj)
         return obj
Example #7
0
    def new_service(self, name, conf):
        if name in self._services or name in self._builtin_services:
            raise FirewallError(errors.NAME_CONFLICT,
                                "new_service(): '%s'" % name)

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

        service_writer(x)
        self.add_service(x)
        return x
Example #8
0
    def new_service(self, name, conf):
        if name in self._services or name in self._builtin_services:
            raise FirewallError(errors.NAME_CONFLICT,
                                "new_service(): '%s'" % name)

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

        service_writer(x)
        self.add_service(x)
        return x
Example #9
0
    def new_service(self, name, config):
        try:
            self.get_service(name)
        except:
            pass
        else:
            raise FirewallError(NAME_CONFLICT, name)

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

        service_writer(x)
        self.add_service(x)
        return x
Example #10
0
    def set_service_config(self, obj, conf):
        conf_dict = {}
        for i, value in enumerate(conf):
            conf_dict[obj.IMPORT_EXPORT_STRUCTURE[i][0]] = value

        if obj.builtin:
            x = copy.copy(obj)
            x.import_config_dict(conf_dict)
            x.path = config.ETC_FIREWALLD_SERVICES
            x.builtin = False
            if obj.path != x.path:
                x.default = False
            self.add_service(x)
            service_writer(x)
            return x
        else:
            obj.import_config_dict(conf_dict)
            service_writer(obj)
            return obj
Example #11
0
    def new_service(self, name, config):
        try:
            self.get_service(name)
        except:
            pass
        else:
            raise FirewallError(NAME_CONFLICT, "new_service(): '%s'" % name)

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

        service_writer(x)
        self.add_service(x)
        return x
Example #12
0
    def new_service(self, name, config):
        try:
            self.get_service(name)
        except:
            pass
        else:
            raise FirewallError(NAME_CONFLICT, "new_service(): '%s'" % name)

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

        service_writer(x)
        self.add_service(x)
        return x
Example #13
0
    def new_service(self, name, conf):
        if name in self._services or name in self._builtin_services:
            raise FirewallError(errors.NAME_CONFLICT,
                                "new_service(): '%s'" % name)

        conf_dict = {}
        for i, value in enumerate(conf):
            conf_dict[Service.IMPORT_EXPORT_STRUCTURE[i][0]] = value

        x = Service()
        x.check_name(name)
        x.import_config_dict(conf_dict)
        x.name = name
        x.filename = "%s.xml" % name
        x.path = config.ETC_FIREWALLD_SERVICES
        # It is not possible to add a new one with a name of a buitin
        x.builtin = False
        x.default = True

        service_writer(x)
        self.add_service(x)
        return x