[Kimchi-devel] [PATCH] [Kimchi] Remove role_key parameter

Daniel Henrique Barboza dhbarboza82 at gmail.com
Fri Jan 20 18:23:52 UTC 2017


Reviewed-by: Daniel Barboza <danielhb at linux.vnet.ibm.com>
Tested-by: Daniel Barboza <danielhb at linux.vnet.ibm.com>

On 01/19/2017 10:18 AM, Aline Manera wrote:
> Signed-off-by: Aline Manera <alinefm at linux.vnet.ibm.com>
> ---
>   control/cpuinfo.py        | 3 +--
>   control/groups.py         | 3 +--
>   control/host.py           | 7 +------
>   control/interfaces.py     | 4 +---
>   control/networks.py       | 4 +---
>   control/peers.py          | 3 +--
>   control/storagepools.py   | 4 +---
>   control/storageservers.py | 5 +----
>   control/templates.py      | 4 +---
>   control/users.py          | 3 +--
>   control/vms.py            | 6 +-----
>   11 files changed, 11 insertions(+), 35 deletions(-)
>
> diff --git a/control/cpuinfo.py b/control/cpuinfo.py
> index f795b3f..322ff8f 100644
> --- a/control/cpuinfo.py
> +++ b/control/cpuinfo.py
> @@ -1,7 +1,7 @@
>   #
>   # Project Kimchi
>   #
> -# Copyright IBM Corp, 2015-2016
> +# Copyright IBM Corp, 2015-2017
>   #
>   # This library is free software; you can redistribute it and/or
>   # modify it under the terms of the GNU Lesser General Public
> @@ -25,7 +25,6 @@ class CPUInfo(Resource):
>       def __init__(self, model):
>           super(CPUInfo, self).__init__(model)
>           self.admin_methods = ['GET']
> -        self.role_key = 'host'
>           self.uri_fmt = "/host/cpuinfo"
>   
>       @property
> diff --git a/control/groups.py b/control/groups.py
> index 8c5c4c6..1e037bd 100644
> --- a/control/groups.py
> +++ b/control/groups.py
> @@ -1,7 +1,7 @@
>   #
>   # Project Kimchi
>   #
> -# Copyright IBM Corp, 2015-2016
> +# Copyright IBM Corp, 2015-2017
>   #
>   # This library is free software; you can redistribute it and/or
>   # modify it under the terms of the GNU Lesser General Public
> @@ -25,4 +25,3 @@ from wok.control.utils import UrlSubNode
>   class Groups(SimpleCollection):
>       def __init__(self, model):
>           super(Groups, self).__init__(model)
> -        self.role_key = 'guests'
> diff --git a/control/host.py b/control/host.py
> index 6d52bc1..b1204fe 100644
> --- a/control/host.py
> +++ b/control/host.py
> @@ -1,7 +1,7 @@
>   #
>   # Project Kimchi
>   #
> -# Copyright IBM Corp, 2015-2016
> +# Copyright IBM Corp, 2015-2017
>   #
>   # This library is free software; you can redistribute it and/or
>   # modify it under the terms of the GNU Lesser General Public
> @@ -30,7 +30,6 @@ from wok.plugins.kimchi.utils import is_s390x
>   class Host(Resource):
>       def __init__(self, model, id=None):
>           super(Host, self).__init__(model, id)
> -        self.role_key = 'host'
>           self.admin_methods = ['GET', 'POST']
>           self.uri_fmt = '/host/%s'
>           self.devices = Devices(self.model)
> @@ -46,7 +45,6 @@ class Host(Resource):
>   class VolumeGroups(Collection):
>       def __init__(self, model):
>           super(VolumeGroups, self).__init__(model)
> -        self.role_key = 'host'
>           self.uri_fmt = "/host/vgs"
>           self.admin_methods = ['GET']
>           self.resource = VolumeGroup
> @@ -55,7 +53,6 @@ class VolumeGroups(Collection):
>   class VolumeGroup(Resource):
>       def __init__(self, model, id=None):
>           super(VolumeGroup, self).__init__(model, id)
> -        self.role_key = 'host'
>           self.uri_fmt = "/host/vgs/%s"
>           self.admin_methods = ['GET']
>   
> @@ -89,7 +86,6 @@ class Device(Resource):
>   class Partitions(Collection):
>       def __init__(self, model):
>           super(Partitions, self).__init__(model)
> -        self.role_key = 'storage'
>           self.admin_methods = ['GET']
>           self.resource = Partition
>   
> @@ -112,7 +108,6 @@ class Partitions(Collection):
>   
>   class Partition(Resource):
>       def __init__(self, model, id):
> -        self.role_key = 'storage'
>           self.admin_methods = ['GET']
>           super(Partition, self).__init__(model, id)
>   
> diff --git a/control/interfaces.py b/control/interfaces.py
> index c65839a..7b6127a 100644
> --- a/control/interfaces.py
> +++ b/control/interfaces.py
> @@ -1,7 +1,7 @@
>   #
>   # Project Kimchi
>   #
> -# Copyright IBM Corp, 2015-2016
> +# Copyright IBM Corp, 2015-2017
>   #
>   # This library is free software; you can redistribute it and/or
>   # modify it under the terms of the GNU Lesser General Public
> @@ -25,7 +25,6 @@ from wok.control.utils import UrlSubNode
>   class Interfaces(Collection):
>       def __init__(self, model):
>           super(Interfaces, self).__init__(model)
> -        self.role_key = 'network'
>           self.admin_methods = ['GET']
>           self.resource = Interface
>   
> @@ -33,7 +32,6 @@ class Interfaces(Collection):
>   class Interface(Resource):
>       def __init__(self, model, ident):
>           super(Interface, self).__init__(model, ident)
> -        self.role_key = 'network'
>           self.admin_methods = ['GET']
>           self.uri_fmt = "/interfaces/%s"
>   
> diff --git a/control/networks.py b/control/networks.py
> index 1b8012e..d743873 100644
> --- a/control/networks.py
> +++ b/control/networks.py
> @@ -1,7 +1,7 @@
>   #
>   # Project Kimchi
>   #
> -# Copyright IBM Corp, 2015-2016
> +# Copyright IBM Corp, 2015-2017
>   #
>   # This library is free software; you can redistribute it and/or
>   # modify it under the terms of the GNU Lesser General Public
> @@ -39,7 +39,6 @@ NETWORK_REQUESTS = {
>   class Networks(Collection):
>       def __init__(self, model):
>           super(Networks, self).__init__(model)
> -        self.role_key = 'network'
>           self.admin_methods = ['POST']
>           self.resource = Network
>   
> @@ -51,7 +50,6 @@ class Networks(Collection):
>   class Network(Resource):
>       def __init__(self, model, ident):
>           super(Network, self).__init__(model, ident)
> -        self.role_key = 'network'
>           self.admin_methods = ['PUT', 'POST', 'DELETE']
>           self.uri_fmt = "/networks/%s"
>           self.activate = self.generate_action_handler('activate')
> diff --git a/control/peers.py b/control/peers.py
> index c0d83ac..5eaacdd 100644
> --- a/control/peers.py
> +++ b/control/peers.py
> @@ -1,7 +1,7 @@
>   #
>   # Project Kimchi
>   #
> -# Copyright IBM Corp, 2015-2016
> +# Copyright IBM Corp, 2015-2017
>   #
>   # This library is free software; you can redistribute it and/or
>   # modify it under the terms of the GNU Lesser General Public
> @@ -25,5 +25,4 @@ from wok.control.utils import UrlSubNode
>   class Peers(SimpleCollection):
>       def __init__(self, model):
>           super(Peers, self).__init__(model)
> -        self.role_key = 'peers'
>           self.admin_methods = ['GET']
> diff --git a/control/storagepools.py b/control/storagepools.py
> index e188aae..26aab7d 100644
> --- a/control/storagepools.py
> +++ b/control/storagepools.py
> @@ -1,7 +1,7 @@
>   #
>   # Project Kimchi
>   #
> -# Copyright IBM Corp, 2015-2016
> +# Copyright IBM Corp, 2015-2017
>   #
>   # This library is free software; you can redistribute it and/or
>   # modify it under the terms of the GNU Lesser General Public
> @@ -47,7 +47,6 @@ STORAGEPOOL_REQUESTS = {
>   class StoragePools(Collection):
>       def __init__(self, model):
>           super(StoragePools, self).__init__(model)
> -        self.role_key = 'storage'
>           self.admin_methods = ['POST']
>           self.resource = StoragePool
>           isos = IsoPool(model)
> @@ -95,7 +94,6 @@ class StoragePools(Collection):
>   class StoragePool(Resource):
>       def __init__(self, model, ident):
>           super(StoragePool, self).__init__(model, ident)
> -        self.role_key = 'storage'
>           self.admin_methods = ['PUT', 'POST', 'DELETE']
>           self.uri_fmt = "/storagepools/%s"
>           self.activate = self.generate_action_handler('activate')
> diff --git a/control/storageservers.py b/control/storageservers.py
> index 9f9cade..9d18514 100644
> --- a/control/storageservers.py
> +++ b/control/storageservers.py
> @@ -1,7 +1,7 @@
>   #
>   # Project Kimchi
>   #
> -# Copyright IBM Corp, 2015-2016
> +# Copyright IBM Corp, 2015-2017
>   #
>   # This library is free software; you can redistribute it and/or
>   # modify it under the terms of the GNU Lesser General Public
> @@ -26,7 +26,6 @@ from wok.control.utils import get_class_name, model_fn, UrlSubNode
>   class StorageServers(Collection):
>       def __init__(self, model):
>           super(StorageServers, self).__init__(model)
> -        self.role_key = 'storage'
>           self.admin_methods = ['GET']
>           self.resource = StorageServer
>   
> @@ -34,7 +33,6 @@ class StorageServers(Collection):
>   class StorageServer(Resource):
>       def __init__(self, model, ident):
>           super(StorageServer, self).__init__(model, ident)
> -        self.role_key = 'storage'
>           self.admin_methods = ['GET']
>           self.storagetargets = StorageTargets(self.model,
>                                                self.ident.decode("utf-8"))
> @@ -47,7 +45,6 @@ class StorageServer(Resource):
>   class StorageTargets(Collection):
>       def __init__(self, model, server):
>           super(StorageTargets, self).__init__(model)
> -        self.role_key = 'storage'
>           self.admin_methods = ['GET']
>           self.server = server
>           self.resource_args = [self.server, ]
> diff --git a/control/templates.py b/control/templates.py
> index ca36be3..a5d7dd5 100644
> --- a/control/templates.py
> +++ b/control/templates.py
> @@ -1,7 +1,7 @@
>   #
>   # Project Kimchi
>   #
> -# Copyright IBM Corp, 2015-2016
> +# Copyright IBM Corp, 2015-2017
>   #
>   # This library is free software; you can redistribute it and/or
>   # modify it under the terms of the GNU Lesser General Public
> @@ -40,7 +40,6 @@ TEMPLATE_REQUESTS = {
>   class Templates(Collection):
>       def __init__(self, model):
>           super(Templates, self).__init__(model)
> -        self.role_key = 'templates'
>           self.admin_methods = ['GET', 'POST']
>           self.resource = Template
>   
> @@ -52,7 +51,6 @@ class Templates(Collection):
>   class Template(Resource):
>       def __init__(self, model, ident):
>           super(Template, self).__init__(model, ident)
> -        self.role_key = 'templates'
>           self.admin_methods = ['PUT', 'POST', 'DELETE']
>           self.uri_fmt = "/templates/%s"
>           self.clone = self.generate_action_handler('clone')
> diff --git a/control/users.py b/control/users.py
> index e551920..c71b621 100644
> --- a/control/users.py
> +++ b/control/users.py
> @@ -1,7 +1,7 @@
>   #
>   # Project Kimchi
>   #
> -# Copyright IBM Corp, 2015-2016
> +# Copyright IBM Corp, 2015-2017
>   #
>   # This library is free software; you can redistribute it and/or
>   # modify it under the terms of the GNU Lesser General Public
> @@ -26,7 +26,6 @@ from wok.template import render
>   class Users(SimpleCollection):
>       def __init__(self, model):
>           super(Users, self).__init__(model)
> -        self.role_key = 'guests'
>   
>       def get(self, filter_params):
>           res_list = []
> diff --git a/control/vms.py b/control/vms.py
> index 645cb40..80e48e1 100644
> --- a/control/vms.py
> +++ b/control/vms.py
> @@ -1,7 +1,7 @@
>   #
>   # Project Kimchi
>   #
> -# Copyright IBM Corp, 2015-2016
> +# Copyright IBM Corp, 2015-2017
>   #
>   # This library is free software; you can redistribute it and/or
>   # modify it under the terms of the GNU Lesser General Public
> @@ -52,7 +52,6 @@ class VMs(AsyncCollection):
>       def __init__(self, model):
>           super(VMs, self).__init__(model)
>           self.resource = VM
> -        self.role_key = 'guests'
>           self.admin_methods = ['POST']
>   
>           # set user log messages and make sure all parameters are present
> @@ -63,7 +62,6 @@ class VMs(AsyncCollection):
>   class VM(Resource):
>       def __init__(self, model, ident):
>           super(VM, self).__init__(model, ident)
> -        self.role_key = 'guests'
>           self.screenshot = VMScreenShot(model, ident)
>           self.virtviewerfile = VMVirtViewerFile(model, ident)
>           self.uri_fmt = '/vms/%s'
> @@ -98,7 +96,6 @@ class VM(Resource):
>   class VMScreenShot(Resource):
>       def __init__(self, model, ident):
>           super(VMScreenShot, self).__init__(model, ident)
> -        self.role_key = 'guests'
>   
>       def get(self):
>           self.lookup()
> @@ -109,7 +106,6 @@ class VMScreenShot(Resource):
>   class VMVirtViewerFile(Resource):
>       def __init__(self, model, ident):
>           super(VMVirtViewerFile, self).__init__(model, ident)
> -        self.role_key = 'guests'
>   
>       @property
>       def data(self):



More information about the Kimchi-devel mailing list