fail2ban.client.configreader module
***********************************

class fail2ban.client.configreader.ConfigReader(use_config=None, share_config=None, **kwargs)

   Bases: "object"

   Generic config reader class.

   A caching adapter which automatically reuses already shared
   configuration.

   Attributes:
      **share_config**
   -[ Methods ]-

   +------------+--------------------------------------------------------------------------------------------+
   | "options"  | Return a list of option names for the given section name.                                  |
   | (section[, |                                                                                            |
   | withDefau  |                                                                                            |
   | lt])       |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "read"(na  | Overloads a default (not shared) read of config reader.                                    |
   | me[,       |                                                                                            |
   | once])     |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+

   +--------------------+------------+
   | **get**            |            |
   +--------------------+------------+
   | **getBaseDir**     |            |
   +--------------------+------------+
   | **getOptions**     |            |
   +--------------------+------------+
   | **has_option**     |            |
   +--------------------+------------+
   | **has_section**    |            |
   +--------------------+------------+
   | **merge_defaults** |            |
   +--------------------+------------+
   | **merge_section**  |            |
   +--------------------+------------+
   | **sections**       |            |
   +--------------------+------------+
   | **setBaseDir**     |            |
   +--------------------+------------+

   get(sec, opt, raw=False, vars={})

   getBaseDir()

   getOptions(section, *args, **kwargs)

   has_option(sec, opt, withDefault=True)

   has_section(sec)

   merge_defaults(d)

   merge_section(section, *args, **kwargs)

   options(section, withDefault=False)

      Return a list of option names for the given section name.

      Parameter *withDefault* controls the include of names from
      section *[DEFAULT]*

   read(name, once=True)

      Overloads a default (not shared) read of config reader.

      To prevent mutiple reads of config files with it includes, reads
      into  the config reader, if it was not yet cached/shared by
      'name'.

   sections()

   setBaseDir(basedir)

   property share_config

class fail2ban.client.configreader.ConfigReaderUnshared(basedir=None, *args, **kwargs)

   Bases: "SafeConfigParserWithIncludes"

   Unshared config reader (previously ConfigReader).

   Do not use this class (internal not shared/cached represenation).
   Use ConfigReader instead.

   Attributes:
      **converters**
      **share_config**
   -[ Methods ]-

   +------------+--------------------------------------------------------------------------------------------+
   | "add_sect  | Create a new section in the configuration.                                                 |
   | ion"(sect  |                                                                                            |
   | ion)       |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "clear"()  |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "get"(sec  | Get an option value for a given section.                                                   |
   | tion,      |                                                                                            |
   | option,    |                                                                                            |
   | *[, raw,   |                                                                                            |
   | vars,      |                                                                                            |
   | fallback]) |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "get_ex"(  | Get an option value for a given section.                                                   |
   | section,   |                                                                                            |
   | option[,   |                                                                                            |
   | raw,       |                                                                                            |
   | vars])     |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "getint"(  |                                                                                            |
   | section,   |                                                                                            |
   | option,    |                                                                                            |
   | *[, raw,   |                                                                                            |
   | vars,      |                                                                                            |
   | fallback]) |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "has_opti  | Check for the existence of a given option in a given section.                              |
   | on"(secti  |                                                                                            |
   | on,        |                                                                                            |
   | option)    |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "has_sect  | Indicate whether the named section is present in the configuration.                        |
   | ion"(sect  |                                                                                            |
   | ion)       |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "items"([  | Return a list of (name, value) tuples for each option in a section.                        |
   | section,   |                                                                                            |
   | raw,       |                                                                                            |
   | vars])     |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "keys"()   |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "options"  | Return a list of option names for the given section name.                                  |
   | (section[, |                                                                                            |
   | withDefau  |                                                                                            |
   | lt])       |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "pop"(k[,  | If key is not found, d is returned if given, otherwise KeyError is raised.                 |
   | d])        |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "popitem"  | Remove a section from the parser and return it as a (section_name, section_proxy) tuple.   |
   | ()         |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "read"(fi  | Read and parse a filename or an iterable of filenames.                                     |
   | lename)    |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "read_dic  | Read configuration from a dictionary.                                                      |
   | t"(dictio  |                                                                                            |
   | nary[,     |                                                                                            |
   | source])   |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "read_fil  | Like read() but the argument must be a file-like object.                                   |
   | e"(f[,     |                                                                                            |
   | source])   |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "read_str  | Read configuration from a given string.                                                    |
   | ing"(stri  |                                                                                            |
   | ng[,       |                                                                                            |
   | source])   |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "remove_o  | Remove an option.                                                                          |
   | ption"(se  |                                                                                            |
   | ction,     |                                                                                            |
   | option)    |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "remove_s  | Remove a file section.                                                                     |
   | ection"(s  |                                                                                            |
   | ection)    |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "sections  | Return a list of section names, excluding [DEFAULT]                                        |
   | "()        |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "set"(sec  | Set an option.                                                                             |
   | tion,      |                                                                                            |
   | option[,   |                                                                                            |
   | value])    |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "setdefau  |                                                                                            |
   | lt"(k[,d]) |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "update"(  | If E present and has a .keys() method, does:     for k in E: D[k] = E[k] If E present and  |
   | [E, ]**F)  | lacks .keys() method, does:     for (k, v) in E: D[k] = v In either case, this is followed |
   |            | by: for k, v in F.items(): D[k] = v                                                        |
   +------------+--------------------------------------------------------------------------------------------+
   | "values"() |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "write"(f  | Write an .ini-format representation of the configuration state.                            |
   | p[, space  |                                                                                            |
   | _around_d  |                                                                                            |
   | elimiters  |                                                                                            |
   | ])         |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+

   +-------------------+------------+
   | **defaults**      |            |
   +-------------------+------------+
   | **getBaseDir**    |            |
   +-------------------+------------+
   | **getOptions**    |            |
   +-------------------+------------+
   | **get_defaults**  |            |
   +-------------------+------------+
   | **get_sections**  |            |
   +-------------------+------------+
   | **getboolean**    |            |
   +-------------------+------------+
   | **getfloat**      |            |
   +-------------------+------------+
   | **merge_section** |            |
   +-------------------+------------+
   | **optionxform**   |            |
   +-------------------+------------+
   | **setBaseDir**    |            |
   +-------------------+------------+

   DEFAULT_BASEDIR = '/usr/pkg/etc/fail2ban'

   getBaseDir()

   getOptions(sec, options, pOptions=None, shouldExist=False, convert=True)

   read(filename)

      Read and parse a filename or an iterable of filenames.

      Files that cannot be opened are silently ignored; this is
      designed so that you can specify an iterable of potential
      configuration file locations (e.g. current directory, user's
      home directory, systemwide directory), and all existing
      configuration files in the iterable will be read.  A single
      filename may also be given.

      Return list of successfully read files.

   setBaseDir(basedir)

class fail2ban.client.configreader.DefinitionInitConfigReader(file_, jailName, initOpts, **kwargs)

   Bases: "ConfigReader"

   Config reader for files with options grouped in [Definition] and
   [Init] sections.

   Is a base class for readers of filters and actions, where
   definitions in jails might provide custom values for options
   defined in [Init] section.

   Attributes:
      **share_config**
   -[ Methods ]-

   +------------+--------------------------------------------------------------------------------------------+
   | "convertO  | Convert interpolated combined options to expected type.                                    |
   | ptions"(o  |                                                                                            |
   | pts, conf  |                                                                                            |
   | igOpts)    |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "getCombO  | Get combined definition option (as string) using pre-set and init options as preselection  |
   | ption"(op  | (values with higher precedence as specified in section).                                   |
   | tname)     |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "options"  | Return a list of option names for the given section name.                                  |
   | (section[, |                                                                                            |
   | withDefau  |                                                                                            |
   | lt])       |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+
   | "read"()   | Overloads a default (not shared) read of config reader.                                    |
   +------------+--------------------------------------------------------------------------------------------+
   | "readexpl  |                                                                                            |
   | icit"()    |                                                                                            |
   +------------+--------------------------------------------------------------------------------------------+

   +--------------------+------------+
   | **convert**        |            |
   +--------------------+------------+
   | **get**            |            |
   +--------------------+------------+
   | **getBaseDir**     |            |
   +--------------------+------------+
   | **getCombined**    |            |
   +--------------------+------------+
   | **getFile**        |            |
   +--------------------+------------+
   | **getJailName**    |            |
   +--------------------+------------+
   | **getOptions**     |            |
   +--------------------+------------+
   | **has_option**     |            |
   +--------------------+------------+
   | **has_section**    |            |
   +--------------------+------------+
   | **merge_defaults** |            |
   +--------------------+------------+
   | **merge_section**  |            |
   +--------------------+------------+
   | **sections**       |            |
   +--------------------+------------+
   | **setBaseDir**     |            |
   +--------------------+------------+
   | **setFile**        |            |
   +--------------------+------------+
   | **setJailName**    |            |
   +--------------------+------------+

   convert()

   convertOptions(opts, configOpts)

      Convert interpolated combined options to expected type.

   getCombOption(optname)

      Get combined definition option (as string) using pre-set and
      init options as preselection (values with higher precedence as
      specified in section).

      Can be used only after calling of getOptions.

   getCombined(ignore=())

   getFile()

   getJailName()

   getOptions(pOpts, all=False)

   read()

      Overloads a default (not shared) read of config reader.

      To prevent mutiple reads of config files with it includes, reads
      into  the config reader, if it was not yet cached/shared by
      'name'.

   readexplicit()

   setFile(fileName)

   setJailName(jailName)
