prelude-correlator/master: Method for configuration option value retrieval no take an optional type argument
[email protected] Thu, 9 Jul 2009 17:57:28 +0200 (CEST)
| Newsgroups | gmane.comp.security.ids.prelude.cvs |
|---|---|
| Message-ID | <[email protected]> |
commit a04256bf251cc054aff0c56e06c1f5ef56a47e27 Author: Yoann Vandoorselaere <[email protected]> Date: Thu Jul 9 17:22:55 2009 +0200 Method for configuration option value retrieval no take an optional type argument This argument might be used to indicate the type of the value returned (the default is str). Update the dshield plugin so that it specify an int and float return type for the reload and timeout options. ======================================== PreludeCorrelator/config.py | 4 ++-- PreludeCorrelator/pluginmanager.py | 4 ++-- PreludeCorrelator/plugins/dshield.py | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) ======================================== diff --git a/PreludeCorrelator/config.py b/PreludeCorrelator/config.py index 4beea52..25fbd4e 100644 --- a/PreludeCorrelator/config.py +++ b/PreludeCorrelator/config.py @@ -24,9 +24,9 @@ class Config(ConfigParser.ConfigParser): ConfigParser.ConfigParser.__init__(self) self.read(filename) - def get(self, section, option, raw=None, vars=None, default=None): + def get(self, section, option, raw=None, vars=None, default=None, type=str): try: - return ConfigParser.ConfigParser.get(self, section, option, raw, vars) + return type(ConfigParser.ConfigParser.get(self, section, option, raw, vars)) except ConfigParser.NoSectionError: return default diff --git a/PreludeCorrelator/pluginmanager.py b/PreludeCorrelator/pluginmanager.py index 72b853e..fe6131f 100644 --- a/PreludeCorrelator/pluginmanager.py +++ b/PreludeCorrelator/pluginmanager.py @@ -44,8 +44,8 @@ class PluginLog: class Plugin(object, PluginLog): enable = True - def getConfigValue(self, option, default=None): - return self.env.config.get(self.__class__.__name__, option, default=default) + def getConfigValue(self, option, default=None, type=str): + return self.env.config.get(self.__class__.__name__, option, default=default, type=type) def __init__(self, env): self.env = env diff --git a/PreludeCorrelator/plugins/dshield.py b/PreludeCorrelator/plugins/dshield.py index 88908e5..ff108cd 100644 --- a/PreludeCorrelator/plugins/dshield.py +++ b/PreludeCorrelator/plugins/dshield.py @@ -83,11 +83,11 @@ class DshieldPlugin(Plugin): Plugin.__init__(self, env) self.__iphash = { } - self.__reload = self.getConfigValue("reload", self.DSHIELD_RELOAD) + self.__reload = self.getConfigValue("reload", self.DSHIELD_RELOAD, type=int) self.__filename = self.getConfigValue("filename", self.DSHIELD_FILENAME) self.__server = self.getConfigValue("server", self.DSHIELD_SERVER) self.__uri = self.getConfigValue("uri", self.DSHIELD_URI) - self.__timeout = float(self.getConfigValue("timeout", self.DSHIELD_TIMEOUT)) + self.__timeout = self.getConfigValue("timeout", self.DSHIELD_TIMEOUT, type=float) self.__retrieveData() def run(self, idmef): _______________________________________________ Prelude-cvslog site list [email protected] http://lists.prelude-ids.org/mailman/listinfo/prelude-cvslog