[Kimchi-devel] [PATCH][Wok 5/5] Change plugins API documentation by pluginsmanager API

Rodrigo Trujillo rodrigo.trujillo at linux.vnet.ibm.com
Wed Jun 1 19:36:45 UTC 2016



On 06/01/2016 12:20 AM, Aline Manera wrote:
> Please, also add new test cases to cover the API changes.
It would be a "next ToDo",  i will try to add in V2

>
> One question below:
>
> On 05/31/2016 02:51 PM, Rodrigo Trujillo wrote:
>> This patch creates the documentation for pluginsmanager API
>>
>> Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo at linux.vnet.ibm.com>
>> ---
>>   docs/API/plugins.md        | 13 ----------
>>   docs/API/pluginsmanager.md | 61 
>> ++++++++++++++++++++++++++++++++++++++++++++++
>>   2 files changed, 61 insertions(+), 13 deletions(-)
>>   delete mode 100644 docs/API/plugins.md
>>   create mode 100644 docs/API/pluginsmanager.md
>>
>> diff --git a/docs/API/plugins.md b/docs/API/plugins.md
>> deleted file mode 100644
>> index aaa37b5..0000000
>> --- a/docs/API/plugins.md
>> +++ /dev/null
>> @@ -1,13 +0,0 @@
>> -## REST API Specification for Plugins
>> -
>> -### Collection: Plugins
>> -
>> -**URI:** /plugins
>> -
>> -**Methods:**
>> -
>> -* **GET**: Retrieve a summarized list names of all UI Plugins
>> -
>> -#### Examples
>> -GET /plugins
>> -[pluginA, pluginB, pluginC]
>> diff --git a/docs/API/pluginsmanager.md b/docs/API/pluginsmanager.md
>> new file mode 100644
>> index 0000000..23381d3
>> --- /dev/null
>> +++ b/docs/API/pluginsmanager.md
>> @@ -0,0 +1,61 @@
>> +## REST API Specification for Plugins Manager
>> +
>> +### Collection: Plugins
>> +
>> +**URI:** /pluginsmanager
>> +
>> +**Methods:**
>> +
>> +* **GET**: Retrieve a list of all Plugins configured in Wok, showing 
>> name and state.
>> +
>> +#### Examples
>> +GET /pluginsmanager
>> +[
>> +  {
>> +    "enabled":true,
>> +    "name":"gingerbase"
>> +  },
>> +  {
>> +    "enabled":true,
>> +    "name":"kimchi"
>> +  },
>> +  {
>> +    "enabled":false,
>> +    "name":"sample"
>> +  }
>> +]
>> +
>> +### Resource: Plugin
>> +
>> +**URI:** /pluginsmanager/*:name*
>> +
>> +A plugin represents a software that will make use of infrastructure 
>> provided
>> +by Wok. It should be installed in a directory with its <name> in Wok 
>> directory
>> +'plugins' and contains an <name>.conf file.
>> +Example: "/usr/lib/python2.7/site-packages/wok/plugins/kimchi"
>> +
>> +**Methods:**
>> +
>> +* **GET**: Retrieve the full description of the plugin.
>> +    * name: The plugin name
>> +    * enabled: State of the plugin. If not enabled, Wok will not 
>> load it
>> +* **POST**: *See Task Actions*
>> +
>> +**Actions (POST):**
>> +
>> +* enable: enable a disabled plugin. Also changes plugin's 
>> configuration file
>> +
>> +* disable: disable a enabled plugin. Also changes plugin's 
>> configuration file
>> +
>
> Does that mean trying to enable a enabled plugin will raise an error? 
> And similar to disable a disabled plugin?
I am not raising any error... I just return ... see:

**********************************
         def _change_plugin_state(self, name, enable=True):
             plugin = self._plugins_dict[name]
             if plugin['enabled'] == enable:
                 return
         ...
**********************************

I think that raise an error just saying "Plugin already 
enabled/(disable)"  is useless.
Do you see any reason to add ?

>
>> +#### Examples
>> +GET /pluginsmanager/sample
>> +{
>> +    "enabled":false,
>> +    "name":"sample"
>> +}
>> +
>> +POST /pluginsmanager/sample/enable
>> +{
>> +    "enabled":true,
>> +    "name":"sample"
>> +}
>
> _______________________________________________
> 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