[PATCH] [WoK] ** PLEASE APPLY ASAP ** WoK unable to load Ginger

From: Daniel Henrique Barboza <dhbarboza82@gmail.com> Recent WoK changes broke Ginger loading: Failed to import subnodes for plugin plugins.ginger.Ginger, error: Class plugins.ginger.control.sub_nodes can not be imported, error: No module named control This patch fixes it. Daniel Henrique Barboza (1): Fixing loading of the 'Ginger' plug-in src/wok/server.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) -- 2.5.0

From: Daniel Henrique Barboza <dhbarboza82@gmail.com> Recent WoK changes were made considering that all WoK plug-ins have the control modules in a dir named 'control', but Ginger, for historical/unknown reasons, uses the dir 'controls'. The result is that WoK became unable of loading Ginger. This patch amends it. It is needed to change both 'controls' and 'models' Ginger dirs to 'control' and 'model' so Ginger can be compliant with the rest of WoK plug-ins. Until then, WoK will need to consider this awkward Ginger design when doing plug-in wide changes like the one made. Signed-off-by: Daniel Henrique Barboza <dhbarboza82@gmail.com> --- src/wok/server.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/wok/server.py b/src/wok/server.py index 4fd380c..42a88f7 100644 --- a/src/wok/server.py +++ b/src/wok/server.py @@ -170,8 +170,13 @@ class Server(object): # dynamically add tools.wokauth.on = True to extra plugin APIs try: - sub_nodes = import_class('plugins.%s.control.sub_nodes' % - plugin_name) + # FIXME when Ginger padronizes its dir names. + if plugin_name != 'ginger': + sub_nodes = import_class('plugins.%s.control.sub_nodes' % + plugin_name) + else: + sub_nodes = import_class('plugins.%s.controls.sub_nodes' % + plugin_name) except ImportError, e: cherrypy.log.error_log.error( "Failed to import subnodes for plugin %s, " -- 2.5.0

Reviewed-by: Chandra Shekhar Reddy Potula <chandra@linux.vnet.ibm.com> Suggestion why plugin ginger has folder name as 'controls' and all other plugins have it as 'control'. I guess this should be corrected to have consistency going forward. On 24/01/16 7:33 PM, dhbarboza82@gmail.com wrote:
From: Daniel Henrique Barboza <dhbarboza82@gmail.com>
Recent WoK changes were made considering that all WoK plug-ins have the control modules in a dir named 'control', but Ginger, for historical/unknown reasons, uses the dir 'controls'. The result is that WoK became unable of loading Ginger. This patch amends it.
It is needed to change both 'controls' and 'models' Ginger dirs to 'control' and 'model' so Ginger can be compliant with the rest of WoK plug-ins. Until then, WoK will need to consider this awkward Ginger design when doing plug-in wide changes like the one made.
Signed-off-by: Daniel Henrique Barboza <dhbarboza82@gmail.com> --- src/wok/server.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/wok/server.py b/src/wok/server.py index 4fd380c..42a88f7 100644 --- a/src/wok/server.py +++ b/src/wok/server.py @@ -170,8 +170,13 @@ class Server(object):
# dynamically add tools.wokauth.on = True to extra plugin APIs try: - sub_nodes = import_class('plugins.%s.control.sub_nodes' % - plugin_name) + # FIXME when Ginger padronizes its dir names. + if plugin_name != 'ginger': + sub_nodes = import_class('plugins.%s.control.sub_nodes' % + plugin_name) + else: + sub_nodes = import_class('plugins.%s.controls.sub_nodes' % + plugin_name) except ImportError, e: cherrypy.log.error_log.error( "Failed to import subnodes for plugin %s, "

On 01/24/2016 12:16 PM, Chandra Shekhar Reddy Potula wrote:
Suggestion why plugin ginger has folder name as 'controls' and all other plugins have it as 'control'. I guess this should be corrected to have consistency going forward.
I've mentioned this in the commit message. This will not be a pretty change to do (it will change absolutely all the imports and who knows what else) but it will be done Until then WoK will have to deal with it ;)

Sure got it !!! Thank you :-) I agree totally agree with you this. But also going forward, it would be great if we understand such core changes and their impact to all plugins and test thoroughly with all plugins when it comes wok frame work. On 24/01/16 8:04 PM, Daniel Henrique Barboza wrote:
On 01/24/2016 12:16 PM, Chandra Shekhar Reddy Potula wrote:
Suggestion why plugin ginger has folder name as 'controls' and all other plugins have it as 'control'. I guess this should be corrected to have consistency going forward.
I've mentioned this in the commit message. This will not be a pretty change to do (it will change absolutely all the imports and who knows what else) but it will be done
Until then WoK will have to deal with it ;)
_______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel

On 01/24/2016 12:16 PM, Chandra Shekhar Reddy Potula wrote:
Reviewed-by: Chandra Shekhar Reddy Potula <chandra@linux.vnet.ibm.com>
Suggestion why plugin ginger has folder name as 'controls' and all other plugins have it as 'control'. I guess this should be corrected to have consistency going forward.
+1 for this suggestion. IMO all the plugins should have the same file structure.
On 24/01/16 7:33 PM, dhbarboza82@gmail.com wrote:
From: Daniel Henrique Barboza <dhbarboza82@gmail.com>
Recent WoK changes were made considering that all WoK plug-ins have the control modules in a dir named 'control', but Ginger, for historical/unknown reasons, uses the dir 'controls'. The result is that WoK became unable of loading Ginger. This patch amends it.
It is needed to change both 'controls' and 'models' Ginger dirs to 'control' and 'model' so Ginger can be compliant with the rest of WoK plug-ins. Until then, WoK will need to consider this awkward Ginger design when doing plug-in wide changes like the one made.
Signed-off-by: Daniel Henrique Barboza <dhbarboza82@gmail.com> --- src/wok/server.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/wok/server.py b/src/wok/server.py index 4fd380c..42a88f7 100644 --- a/src/wok/server.py +++ b/src/wok/server.py @@ -170,8 +170,13 @@ class Server(object):
# dynamically add tools.wokauth.on = True to extra plugin APIs try: - sub_nodes = import_class('plugins.%s.control.sub_nodes' % - plugin_name) + # FIXME when Ginger padronizes its dir names. + if plugin_name != 'ginger': + sub_nodes = import_class('plugins.%s.control.sub_nodes' % + plugin_name) + else: + sub_nodes = import_class('plugins.%s.controls.sub_nodes' % + plugin_name) except ImportError, e: cherrypy.log.error_log.error( "Failed to import subnodes for plugin %s, "
_______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel

Reviewed-by: abhiramk <abhiramk@linux.vnet.ibm.com> Tested-by: abhiramk <abhiramk@linux.vnet.ibm.com> On Sun, 2016-01-24 at 12:03 -0200, dhbarboza82@gmail.com wrote:
From: Daniel Henrique Barboza <dhbarboza82@gmail.com>
Recent WoK changes were made considering that all WoK plug-ins have the control modules in a dir named 'control', but Ginger, for historical/unknown reasons, uses the dir 'controls'. The result is that WoK became unable of loading Ginger. This patch amends it.
It is needed to change both 'controls' and 'models' Ginger dirs to 'control' and 'model' so Ginger can be compliant with the rest of WoK plug-ins. Until then, WoK will need to consider this awkward Ginger design when doing plug-in wide changes like the one made.
Signed-off-by: Daniel Henrique Barboza <dhbarboza82@gmail.com> --- src/wok/server.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/wok/server.py b/src/wok/server.py index 4fd380c..42a88f7 100644 --- a/src/wok/server.py +++ b/src/wok/server.py @@ -170,8 +170,13 @@ class Server(object):
# dynamically add tools.wokauth.on = True to extra plugin APIs try: - sub_nodes = import_class('plugins.%s.control.sub_nodes' % - plugin_name) + # FIXME when Ginger padronizes its dir names. + if plugin_name != 'ginger': + sub_nodes = import_class('plugins.%s.control.sub_nodes' % + plugin_name) + else: + sub_nodes = import_class('plugins.%s.controls.sub_nodes' % + plugin_name) except ImportError, e: cherrypy.log.error_log.error( "Failed to import subnodes for plugin %s, "

Hi Daniel, We should consider the file structure for all the plugins. Otherwise, wok will be unmanageable. What about rename the controls dir to control? Regards, Aline Manera On 01/24/2016 12:03 PM, dhbarboza82@gmail.com wrote:
From: Daniel Henrique Barboza <dhbarboza82@gmail.com>
Recent WoK changes were made considering that all WoK plug-ins have the control modules in a dir named 'control', but Ginger, for historical/unknown reasons, uses the dir 'controls'. The result is that WoK became unable of loading Ginger. This patch amends it.
It is needed to change both 'controls' and 'models' Ginger dirs to 'control' and 'model' so Ginger can be compliant with the rest of WoK plug-ins. Until then, WoK will need to consider this awkward Ginger design when doing plug-in wide changes like the one made.
Signed-off-by: Daniel Henrique Barboza <dhbarboza82@gmail.com> --- src/wok/server.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/wok/server.py b/src/wok/server.py index 4fd380c..42a88f7 100644 --- a/src/wok/server.py +++ b/src/wok/server.py @@ -170,8 +170,13 @@ class Server(object):
# dynamically add tools.wokauth.on = True to extra plugin APIs try: - sub_nodes = import_class('plugins.%s.control.sub_nodes' % - plugin_name) + # FIXME when Ginger padronizes its dir names. + if plugin_name != 'ginger': + sub_nodes = import_class('plugins.%s.control.sub_nodes' % + plugin_name) + else: + sub_nodes = import_class('plugins.%s.controls.sub_nodes' % + plugin_name) except ImportError, e: cherrypy.log.error_log.error( "Failed to import subnodes for plugin %s, "

On 25/01/16 4:17 PM, Aline Manera wrote:
Hi Daniel,
We should consider the file structure for all the plugins. Otherwise, wok will be unmanageable.
What about rename the controls dir to control?
But I guess we should apply this patch and create new ticket to fix current trouble. I guess we have to do thorough test with folder name changes as it should not impact in any means to overall plugin and then take off this extra condition till we have proper one.
Regards, Aline Manera
On 01/24/2016 12:03 PM, dhbarboza82@gmail.com wrote:
From: Daniel Henrique Barboza <dhbarboza82@gmail.com>
Recent WoK changes were made considering that all WoK plug-ins have the control modules in a dir named 'control', but Ginger, for historical/unknown reasons, uses the dir 'controls'. The result is that WoK became unable of loading Ginger. This patch amends it.
It is needed to change both 'controls' and 'models' Ginger dirs to 'control' and 'model' so Ginger can be compliant with the rest of WoK plug-ins. Until then, WoK will need to consider this awkward Ginger design when doing plug-in wide changes like the one made.
Signed-off-by: Daniel Henrique Barboza <dhbarboza82@gmail.com> --- src/wok/server.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/wok/server.py b/src/wok/server.py index 4fd380c..42a88f7 100644 --- a/src/wok/server.py +++ b/src/wok/server.py @@ -170,8 +170,13 @@ class Server(object):
# dynamically add tools.wokauth.on = True to extra plugin APIs try: - sub_nodes = import_class('plugins.%s.control.sub_nodes' % - plugin_name) + # FIXME when Ginger padronizes its dir names. + if plugin_name != 'ginger': + sub_nodes = import_class('plugins.%s.control.sub_nodes' % + plugin_name) + else: + sub_nodes = import_class('plugins.%s.controls.sub_nodes' % + plugin_name) except ImportError, e: cherrypy.log.error_log.error( "Failed to import subnodes for plugin %s, "
_______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel

I also was looking at the wok code and the exception about sub_nodes is not raised, just logged into log files. In src/wok/server.py # dynamically add tools.wokauth.on = True to extra plugin APIs try: sub_nodes = import_class('plugins.%s.control.sub_nodes' % plugin_name) except ImportError, e: cherrypy.log.error_log.error( "Failed to import subnodes for plugin %s, " "error: %s" % (plugin_class, e.message) ) continue So the presence or not of sub_nodes should not block the plugin to be loaded. On 01/25/2016 08:47 AM, Aline Manera wrote:
Hi Daniel,
We should consider the file structure for all the plugins. Otherwise, wok will be unmanageable.
What about rename the controls dir to control?
Regards, Aline Manera
On 01/24/2016 12:03 PM, dhbarboza82@gmail.com wrote:
From: Daniel Henrique Barboza <dhbarboza82@gmail.com>
Recent WoK changes were made considering that all WoK plug-ins have the control modules in a dir named 'control', but Ginger, for historical/unknown reasons, uses the dir 'controls'. The result is that WoK became unable of loading Ginger. This patch amends it.
It is needed to change both 'controls' and 'models' Ginger dirs to 'control' and 'model' so Ginger can be compliant with the rest of WoK plug-ins. Until then, WoK will need to consider this awkward Ginger design when doing plug-in wide changes like the one made.
Signed-off-by: Daniel Henrique Barboza <dhbarboza82@gmail.com> --- src/wok/server.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/wok/server.py b/src/wok/server.py index 4fd380c..42a88f7 100644 --- a/src/wok/server.py +++ b/src/wok/server.py @@ -170,8 +170,13 @@ class Server(object):
# dynamically add tools.wokauth.on = True to extra plugin APIs try: - sub_nodes = import_class('plugins.%s.control.sub_nodes' % - plugin_name) + # FIXME when Ginger padronizes its dir names. + if plugin_name != 'ginger': + sub_nodes = import_class('plugins.%s.control.sub_nodes' % + plugin_name) + else: + sub_nodes = import_class('plugins.%s.controls.sub_nodes' % + plugin_name) except ImportError, e: cherrypy.log.error_log.error( "Failed to import subnodes for plugin %s, "
_______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel

I've found out the real error. Let me resend the patch On 01/25/2016 09:01 AM, Aline Manera wrote:
I also was looking at the wok code and the exception about sub_nodes is not raised, just logged into log files.
In src/wok/server.py
# dynamically add tools.wokauth.on = True to extra plugin APIs try: sub_nodes = import_class('plugins.%s.control.sub_nodes' % plugin_name) except ImportError, e: cherrypy.log.error_log.error( "Failed to import subnodes for plugin %s, " "error: %s" % (plugin_class, e.message) ) continue
So the presence or not of sub_nodes should not block the plugin to be loaded.
On 01/25/2016 08:47 AM, Aline Manera wrote:
Hi Daniel,
We should consider the file structure for all the plugins. Otherwise, wok will be unmanageable.
What about rename the controls dir to control?
Regards, Aline Manera
On 01/24/2016 12:03 PM, dhbarboza82@gmail.com wrote:
From: Daniel Henrique Barboza <dhbarboza82@gmail.com>
Recent WoK changes were made considering that all WoK plug-ins have the control modules in a dir named 'control', but Ginger, for historical/unknown reasons, uses the dir 'controls'. The result is that WoK became unable of loading Ginger. This patch amends it.
It is needed to change both 'controls' and 'models' Ginger dirs to 'control' and 'model' so Ginger can be compliant with the rest of WoK plug-ins. Until then, WoK will need to consider this awkward Ginger design when doing plug-in wide changes like the one made.
Signed-off-by: Daniel Henrique Barboza <dhbarboza82@gmail.com> --- src/wok/server.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/wok/server.py b/src/wok/server.py index 4fd380c..42a88f7 100644 --- a/src/wok/server.py +++ b/src/wok/server.py @@ -170,8 +170,13 @@ class Server(object):
# dynamically add tools.wokauth.on = True to extra plugin APIs try: - sub_nodes = import_class('plugins.%s.control.sub_nodes' % - plugin_name) + # FIXME when Ginger padronizes its dir names. + if plugin_name != 'ginger': + sub_nodes = import_class('plugins.%s.control.sub_nodes' % + plugin_name) + else: + sub_nodes = import_class('plugins.%s.controls.sub_nodes' % + plugin_name) except ImportError, e: cherrypy.log.error_log.error( "Failed to import subnodes for plugin %s, "
_______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel
participants (6)
-
Abhiram
-
Aline Manera
-
Chandra Shekhar Reddy Potula
-
Daniel Henrique Barboza
-
Daniel Henrique Barboza
-
dhbarboza82@gmail.com