[Kimchi-devel] [PATCH][Wok] Change plugins get_list to return only loaded plugins

Rodrigo Trujillo rodrigo.trujillo at linux.vnet.ibm.com
Wed Dec 16 15:53:57 UTC 2015


When using multiple plugins, it is possible that some plugin has a
problem and is not loaded (like when there is a missing module).
In this cases, Wok is not going to load the plugin in cherrypy
configuration, but plugins API return the missing plugin name.
When this occours, UI becomes broken and it is not possible to use any
other plugin, because Wok UI is blank.
This patch fix this problem, returning only plugins names that were
loaded by Wok.

Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo at linux.vnet.ibm.com>
---
 src/wok/model/plugins.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/wok/model/plugins.py b/src/wok/model/plugins.py
index 3a5a89e..5072563 100644
--- a/src/wok/model/plugins.py
+++ b/src/wok/model/plugins.py
@@ -19,6 +19,8 @@
 # License along with this library; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
 
+import cherrypy
+
 from wok.utils import get_enabled_plugins
 
 
@@ -27,4 +29,5 @@ class PluginsModel(object):
         pass
 
     def get_list(self):
-        return [plugin for (plugin, config) in get_enabled_plugins()]
+        return [plugin for (plugin, config) in get_enabled_plugins()
+                if '/plugins/' + plugin in cherrypy.tree.apps.keys()]
-- 
2.1.0




More information about the Kimchi-devel mailing list