[Kimchi-devel] [PATCH v2] [WoK 00/10] '/config/plugins' API implementation

Aline Manera alinefm at linux.vnet.ibm.com
Wed Jan 25 19:39:30 UTC 2017



On 01/25/2017 05:08 PM, Daniel Henrique Barboza wrote:
>
>
> On 01/25/2017 03:37 PM, Aline Manera wrote:
>> 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?
>
> I am not sure if it's simple to be implemented but I'll look into it 
> and, if feasible,
> add it in v3.
>
>>
>> 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?
>
> I haven't found a way for cherrypy to reload  a configuration on the fly
> without issuing server reload. As far as I've investigated it is not 
> possible to
> retrieve the loaded modules after issuing cherrypy.tree.mount().
>

The right place to look at is: cherrypy.tree.apps. It will be a dict of 
plugin URI and plugin Root instance.

Something like:

{/plugins/kimchi: <KimchiRoot instance>, /plugins/ginger: <GingerRoot 
instance>, ...}

I have not tested it before, but shouldn't we edit this to remove the 
entry we want and add when needed?

> Any help is appreciated.
>
>
>>
>> Regards,
>> Aline Manera
>>
>> On 01/20/2017 03:32 PM, dhbarboza82 at gmail.com wrote:
>>> From: Daniel Henrique Barboza <danielhb at 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 at 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 at arthas wok_all_plugins]$
>>>
>>>
>>> [danielhb at 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 at arthas wok_all_plugins]$
>>>
>>>
>>> [danielhb at 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 at 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
>>>
>>
>> _______________________________________________
>> Kimchi-devel mailing list
>> Kimchi-devel at ovirt.org
>> http://lists.ovirt.org/mailman/listinfo/kimchi-devel
>>
>
> _______________________________________________
> Kimchi-devel mailing list
> Kimchi-devel at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/kimchi-devel
>



More information about the Kimchi-devel mailing list