[Kimchi-devel] [PATCH] [WoK 0/9] '/config/plugins' API implementation

dhbarboza82 at gmail.com dhbarboza82 at gmail.com
Fri Jan 20 12:15:35 UTC 2017


From: Daniel Henrique Barboza <danielhb at linux.vnet.ibm.com>


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 (9):
  /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

 docs/API/config.md         | 31 +++++++++++++++++++++++
 docs/API/plugins.md        | 13 ----------
 src/wok/control/config.py  | 24 ++++++++++++++++--
 src/wok/control/plugins.py | 29 ---------------------
 src/wok/i18n.py            |  1 +
 src/wok/model/plugins.py   | 32 +++++++++++++++++------
 src/wok/server.py          |  7 +++++-
 src/wok/utils.py           | 63 ++++++++++++++++++++++++++++++++++++++++------
 tests/test_api.py          | 47 +++++++++++++++++++++++++++++++++-
 tests/test_utils.py        | 56 ++++++++++++++++++++++++++++++++++++++++-
 ui/js/src/wok.api.js       |  4 +--
 ui/js/src/wok.logos.js     | 11 +++++---
 ui/js/src/wok.main.js      | 12 ++++++---
 13 files changed, 258 insertions(+), 72 deletions(-)
 delete mode 100644 docs/API/plugins.md
 delete mode 100644 src/wok/control/plugins.py

-- 
2.7.4



More information about the Kimchi-devel mailing list