Hi Daniel,
In overall, the patch set looks good but that will not be enough to
close the feature request.
You still need to add support to plugin dependencies. Kimchi and Ginger
depends on Ginger Base and when enable/disabling one, the other should
be enable/disable as well.
We have already talked about a solution to do that and IMO it is simple
to be implemented. Any special reason to do not do that right now?
Also, you should investigate how to enable/disable a plugin on cherrypy
configuration on the fly, without the need to restart Wok server.
Cherrypy handles the API configuration in the form of a dict, maybe only
removing the plugin entry is enough. Have you checked it? Any other
solution/suggestion?
Regards,
Aline Manera
On 01/20/2017 03:32 PM, dhbarboza82(a)gmail.com wrote:
From: Daniel Henrique Barboza <danielhb(a)linux.vnet.ibm.com>
v2:
- added User Log capabilities on /config/plugins/enable|disable actions
- added 'enable=' as a valid entry in the parsing of the conf file
This patch set implements the '/config/plugins' API. The idea
of this API is to replace the current '/plugins' API while
adding a new attribute called 'enabled' in its return value,
representing the current state of the plug-in. It will also
return all the plug-ins, regardless of whether it is loaded
or not.
New actions /config/plugin/*name*/enable and
/config/plugin/*name*/disable were implemented to enable/disable
the plug-in *name* by editing the plug-in .conf file.
This is the API in action:
[danielhb@arthas wok_all_plugins]$ curl -k -u danielhb -H "Content-Type:
application/json" -H "Accept: application/json" -X GET
'https://localhost:8001/config/plugins'Enter host password for user
'danielhb':
[
{
"enabled":true,
"name":"gingerbase"
},
{
"enabled":true,
"name":"kimchi"
},
{
"enabled":true,
"name":"ginger"
}
][danielhb@arthas wok_all_plugins]$
[danielhb@arthas wok_all_plugins]$ curl -k -u danielhb -H "Content-Type:
application/json" -H "Accept: application/json" -X POST
'https://localhost:8001/config/plugins/ginger/disable' -d'{}'
Enter host password for user 'danielhb':
{
"enabled":false,
"name":"ginger"
}[danielhb@arthas wok_all_plugins]$
[danielhb@arthas wok_all_plugins]$ curl -k -u danielhb -H "Content-Type:
applicationjson" -H "Accept: application/json" -X POST
'https://localhost:8001/config/plugins/ginger/enable' -d'{}'
Enter host password for user 'danielhb':
{
"enabled":true,
"name":"ginger"
}[danielhb@arthas wok_all_plugins]$
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Daniel Henrique Barboza (10):
/config/plugins API: docs changes
/config/plugins API: utils changes
/config/plugins: changes in config model
/config/plugins API: model changes
/config/plugins API: test changes
Removing old /plugins API
/config/plugins: changing existing UI calls
/config/plugins: exclude 'sample' plug-in when not in test_mode
Removing configobj, use file operations to edit conf files
/config/plugins API: user log and parser improvements
docs/API/config.md | 31 ++++++++++++++++++++
docs/API/plugins.md | 13 ---------
src/wok/control/config.py | 33 +++++++++++++++++++--
src/wok/control/plugins.py | 29 -------------------
src/wok/i18n.py | 4 +++
src/wok/model/plugins.py | 32 +++++++++++++++------
src/wok/server.py | 7 ++++-
src/wok/utils.py | 65 ++++++++++++++++++++++++++++++++++++-----
tests/test_api.py | 47 +++++++++++++++++++++++++++++-
tests/test_utils.py | 72 +++++++++++++++++++++++++++++++++++++++++++++-
ui/js/src/wok.api.js | 4 +--
ui/js/src/wok.logos.js | 11 ++++---
ui/js/src/wok.main.js | 12 +++++---
13 files changed, 288 insertions(+), 72 deletions(-)
delete mode 100644 docs/API/plugins.md
delete mode 100644 src/wok/control/plugins.py