setroubleshoot/0002-framework-Don-t-stop-w...

41 lines
1.8 KiB
Diff

From e9e2872101db300938a56d79899496c3080a1565 Mon Sep 17 00:00:00 2001
From: Petr Lautrbach <plautrba@redhat.com>
Date: Wed, 12 Jul 2017 18:03:57 +0200
Subject: [PATCH 02/19] framework: Don't stop when the plugin directory is
empty
Fixes: https://pagure.io/setroubleshoot/issue/5
failed to load __init__ plugin
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/setroubleshoot/server.py", line 771, in RunFaultServer
analyze_thread = AnalyzeThread(analysis_queue)
File "/usr/lib/python3/dist-packages/setroubleshoot/analyze.py", line 220, in __init__
Analyze.__init__(self)
File "/usr/lib/python3/dist-packages/setroubleshoot/analyze.py", line 135, in __init__
self.plugins = load_plugins()
File "/usr/lib/python3/dist-packages/setroubleshoot/util.py", line 488, in load_plugins
if mod_fp:
UnboundLocalError: local variable 'mod_fp' referenced before assignment
exception UnboundLocalError: local variable 'mod_fp' referenced before assignment
---
framework/src/setroubleshoot/util.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/framework/src/setroubleshoot/util.py b/framework/src/setroubleshoot/util.py
index d0341d4..de8cda9 100755
--- a/framework/src/setroubleshoot/util.py
+++ b/framework/src/setroubleshoot/util.py
@@ -483,7 +483,8 @@ def load_plugins(filter_glob=None):
mod_fp, mod_path, mod_description = imp.find_module(plugin_name, [plugin_dir])
mod = imp.load_module(module_name, mod_fp, mod_path, mod_description)
except Exception:
- syslog.syslog(syslog.LOG_ERR, "failed to load %s plugin" % plugin_name)
+ syslog.syslog(syslog.LOG_ERR, "failed to initialize plugins in %s" % plugin_dir)
+ return []
if mod_fp:
mod_fp.close()
--
2.14.1