diff --git a/iplugin.py b/iplugin.py index cac9f83..1617ebe 100644 --- a/iplugin.py +++ b/iplugin.py @@ -32,6 +32,14 @@ class IPlugin(object): def hook(self): pass +def validConfRequirements(conf_requirements, iwla, plugin_path): + for r in conf_requirements: + if iwla.getConfValue(r, None) is None: + print '\'%s\' conf value required for %s' % (r, plugin_path) + return False + + return True + def preloadPlugins(plugins, iwla): cache_plugins = {} @@ -62,15 +70,8 @@ def preloadPlugins(plugins, iwla): #print 'Load plugin %s' % (plugin_name) conf_requirements = plugin.getConfRequirements() - - requirement_validated = True - for r in conf_requirements: - conf_value = iwla.getConfValue(r, None) - if conf_value is None: - print '\'%s\' conf value required for %s' % (r, plugin_path) - requirement_validated = False - break - if not requirement_validated: continue + if not validConfRequirements(conf_requirements, iwla, plugin_path): + continue requirements = plugin.getRequirements() diff --git a/iwla.py b/iwla.py index 8b02c79..070fbcc 100755 --- a/iwla.py +++ b/iwla.py @@ -497,6 +497,10 @@ if __name__ == '__main__': iwla = IWLA() + required_conf = ['analyzed_filename', 'domain_name'] + if not validConfRequirements(required_conf, iwla, 'Main Conf'): + sys.exit(0) + if args.stdin: iwla.start(sys.stdin) else: