Hi there,
I am working in a way to enable/disable WoK plug-ins using an API. This is
what we already have regarding plugin management:
- each plug-in has a configuration file, for example ginger.conf:
[wok]
# Enable Ginger plugin on Wok server (values: True|False)
enable = True
(...)
- an API that returns all enable plug-ins:
$ curl -k -u danielhb -H "Content-Type: application/json" -H "Accept:
application/json" -X GET 'https://localhost:8001/plugins'
Enter host password for user 'danielhb':
[
"gingerbase",
"kimchi",
"ginger"
]
The API retrieves the contents of each plug-in config file and return the
plug-in name if enable = True.
This is my proposal to implement this new feature without messing around
too much:
- the /plugins API will now returns all plug-ins, regardless of the
plug-in being
loaded or not. In the previous example the returned value would be:
[{ "name: "gingerbase", "enabled": True} ,
{ "name: "ginger", "enabled": True},
{ "name: "kimchi", "enabled": True} ]
Changes in the existing API calls will be made considering this new format.
- A new PUT method to change the 'enabled' attribute of the plug-ins.
Changing
the attribute will write the new value in the plug-in config file,
allowing WoK
to enable/disable the plug-in in the next reboot.
- To make the changes effective we need to reboot WoK after
enabling/disabling
a plug-in. This can be done by either rebooting WoK in the same PUT
operation I
mentioned above or by a new 'reboot' API in WoK. I am more fond of a new API
but I can live with this 'super PUT' API too.
Note that at this moment we will not supporting load/unload of plug-ins
without
rebooting WoK. This has proven to be challenging considering our current
plug-in loading schema in cherrypy.
Thoughts?
Daniel