[Kimchi-devel] [PATCH 14/16] Move all resources related to plugins to control/plugins.py

Aline Manera alinefm at linux.vnet.ibm.com
Tue Dec 24 10:53:59 UTC 2013


On 12/24/2013 08:47 AM, Sheldon wrote:
> On 12/24/2013 02:41 AM, Aline Manera wrote:
>> From: Aline Manera <alinefm at br.ibm.com>
>>
>> Plugins(Collection) was moved to a new - control/plugins.py
>> That way we can easily know where plugins resource is implemented.
>>
>> Signed-off-by: Aline Manera <alinefm at br.ibm.com>
>> ---
>>   Makefile.am                   |    1 +
>>   src/kimchi/control/plugins.py |   44 
>> +++++++++++++++++++++++++++++++++++++++++
>>   2 files changed, 45 insertions(+)
>>   create mode 100644 src/kimchi/control/plugins.py
>>
>> diff --git a/Makefile.am b/Makefile.am
>> index e942045..7278a9b 100644
>> --- a/Makefile.am
>> +++ b/Makefile.am
>> @@ -51,6 +51,7 @@ PEP8_WHITELIST = \
>>       src/kimchi/control/host.py \
>>       src/kimchi/control/interfaces.py \
>>       src/kimchi/control/networks.py \
>> +    src/kimchi/control/plugins.py \
>>       src/kimchi/control/storagepools.py \
>>       src/kimchi/control/storagevolumes.py \
>>       src/kimchi/control/templates.py \
>> diff --git a/src/kimchi/control/plugins.py 
>> b/src/kimchi/control/plugins.py
>> new file mode 100644
>> index 0000000..c134935
>> --- /dev/null
>> +++ b/src/kimchi/control/plugins.py
>> @@ -0,0 +1,44 @@
>> +#
>> +# Project Kimchi
>> +#
>> +# Copyright IBM, Corp. 2013
>> +#

> $ git show ebf366fd
> the author is:
> zhoumeina <zhoumein at linux.vnet.ibm.com>
> ShaoHe Feng <shaohef at linux.vnet.ibm.com>
> not:
>
> Adam Litke <agl at linux.vnet.ibm.com>

I've just copied the authors from controller.py
I will update that on V2.

>> +# Authors:
>> +#  Adam Litke <agl at linux.vnet.ibm.com>
>> +#  Aline Manera <alinefm at linux.vnet.ibm.com>
>> +#
>> +# This library is free software; you can redistribute it and/or
>> +# modify it under the terms of the GNU Lesser General Public
>> +# License as published by the Free Software Foundation; either
>> +# version 2.1 of the License, or (at your option) any later version.
>> +#
>> +# This library is distributed in the hope that it will be useful,
>> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
>> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
>> +# Lesser General Public License for more details.
>> +#
>> +# You should have received a copy of the GNU Lesser General Public
>> +# License along with this library; if not, write to the Free Software
>> +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  
>> 02110-1301 USA
>> +
>> +import kimchi.template
>> +from kimchi.control.base import Collection, Resource
>> +from kimchi.control.utils import get_class_name, model_fn
>> +
>> +
>> +class Plugins(Collection):
>> +    def __init__(self, model):
>> +        super(Plugins, self).__init__(model)
>> +
>> +    @property
>> +    def data(self):
>> +        return self.info
>> +
>> +    def get(self):
>> +        res_list = []
>> +        try:
>> +            get_list = getattr(self.model, model_fn(self, 'get_list'))
>> +            res_list = get_list(*self.model_args)
>> +        except AttributeError:
>> +            pass
>> +        return kimchi.template.render(get_class_name(self), res_list)
>
>




More information about the Kimchi-devel mailing list