|
|
|
@ -49,25 +49,20 @@ class JailsReader(ConfigReader):
|
|
|
|
|
return ConfigReader.read(self, "jail")
|
|
|
|
|
|
|
|
|
|
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:
|
|
|
|
|
# Get the options of a specific jail.
|
|
|
|
|
jail = JailReader(section, 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 '%s'. Skipping..." % section)
|
|
|
|
|
return False
|
|
|
|
|
if section is None:
|
|
|
|
|
sections = self.sections()
|
|
|
|
|
else:
|
|
|
|
|
sections = [ section ]
|
|
|
|
|
|
|
|
|
|
# Get the options of all jails.
|
|
|
|
|
for sec in self.sections():
|
|
|
|
|
jail = JailReader(sec, basedir=self.getBaseDir(), force_enable=self.__force_enable)
|
|
|
|
|
for sec in sections:
|
|
|
|
|
jail = JailReader(sec, basedir=self.getBaseDir(),
|
|
|
|
|
force_enable=self.__force_enable)
|
|
|
|
|
jail.read()
|
|
|
|
|
ret = jail.getOptions()
|
|
|
|
|
if ret:
|
|
|
|
@ -75,7 +70,7 @@ class JailsReader(ConfigReader):
|
|
|
|
|
# We only add enabled jails
|
|
|
|
|
self.__jails.append(jail)
|
|
|
|
|
else:
|
|
|
|
|
logSys.error("Errors in jail '" + sec + "'. Skipping...")
|
|
|
|
|
logSys.error("Errors in jail %r. Skipping..." % sec)
|
|
|
|
|
return False
|
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|