[Kimchi-devel] [PATCH][Wok] Change plugins get_list to return only loaded plugins
Aline Manera
alinefm at linux.vnet.ibm.com
Wed Dec 16 18:48:25 UTC 2015
On 16/12/2015 13:53, Rodrigo Trujillo wrote:
> 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()]
The plugin URI is specified in its configuration file. We can not assume
it will be always "/plugin" + <name>
More information about the Kimchi-devel
mailing list