Пример #1
0
    def getOptions(self, section=None):
        opts = []
        self.__opts = ConfigReader.getOptions(self, "Definition", opts)

        if section:
            # Get the options of a specific jail.
            jail = JailReader(section)
            jail.read()
            ret = jail.getOptions()
            if ret:
                if jail.isEnabled():
                    # We only add enabled jails
                    self.__jails.append(jail)
            else:
                logSys.error("Errors in jail '%s'. Skipping..." % section)
                return False
        else:
            # Get the options of all jails.
            for sec in self.sections():
                jail = JailReader(sec)
                jail.read()
                ret = jail.getOptions()
                if ret:
                    if jail.isEnabled():
                        # We only add enabled jails
                        self.__jails.append(jail)
                else:
                    logSys.error("Errors in jail '" + sec + "'. Skipping...")
                    return False
        return True
Пример #2
0
    def getOptions(self, section=None):
        """Reads configuration for jail(s) and adds enabled jails to __jails
		"""
        opts = []
        self.__opts = ConfigReader.getOptions(self, "Definition", opts)

        if section is None:
            sections = self.sections()
        else:
            sections = [section]

        # Get the options of all jails.
        parse_status = True
        for sec in sections:
            jail = JailReader(sec,
                              basedir=self.getBaseDir(),
                              force_enable=self.__force_enable)
            jail.read()
            ret = jail.getOptions()
            if ret:
                if jail.isEnabled():
                    # We only add enabled jails
                    self.__jails.append(jail)
            else:
                logSys.error("Errors in jail %r. Skipping..." % sec)
                parse_status = False
        return parse_status