[Kimchi-devel] [PATCH 16/16] Use new control modules in root.py

Sheldon shaohef at linux.vnet.ibm.com
Tue Dec 24 11:26:37 UTC 2013


On 12/24/2013 02:41 AM, Aline Manera wrote:
> --- a/src/kimchi/root.py
> +++ b/src/kimchi/root.py
> @@ -26,13 +26,23 @@ import json
>
>
>   from kimchi import auth
> -from kimchi import controller
>   from kimchi import template
>   from kimchi.config import get_api_schema_file
>   from kimchi.control.utils import parse_request
> -
> -
> -class Root(controller.Resource):
> +from kimchi.control.base import Resource
> +from kimchi.control.config import Config
> +from kimchi.control.debugreports import DebugReports
> +from kimchi.control.host import Host
> +from kimchi.control.interfaces import Interfaces
> +from kimchi.control.networks import Networks
> +from kimchi.control.plugins import Plugins
> +from kimchi.control.storagepools import StoragePools
> +from kimchi.control.tasks import Tasks
> +from kimchi.control.templates import Templates
> +from kimchi.control.vms import VMs
not sure we can move these code to __all__ or other attribute of 
control/__init__.py
just
from kimchi.control.networks import *
> +
> +
> +class Root(Resource):
>       def __init__(self, model, dev_env):
>           self._handled_error = ['error_page.400', 'error_page.404',
>                                  'error_page.405', 'error_page.406',
> @@ -45,17 +55,17 @@ class Root(controller.Resource):
>               self._cp_config = dict([(key, self.error_development_handler)
>                                       for key in self._handled_error])
>
> -        controller.Resource.__init__(self, model)
> -        self.vms = controller.VMs(model)
> -        self.templates = controller.Templates(model)
> -        self.storagepools = controller.StoragePools(model)
> -        self.interfaces = controller.Interfaces(model)
> -        self.networks = controller.Networks(model)
> -        self.tasks = controller.Tasks(model)
> -        self.config = controller.Config(model)
> -        self.host = controller.Host(model)
> -        self.debugreports = controller.DebugReports(model)
> -        self.plugins = controller.Plugins(model)
> +        Resource.__init__(self, model)
> +        self.vms = VMs(model)
> +        self.templates = Templates(model)
> +        self.storagepools = StoragePools(model)
> +        self.interfaces = Interfaces(model)
> +        self.networks = Networks(model)
> +        self.tasks = Tasks(model)
> +        self.config = Config(model)
> +        self.host = Host(model)
> +        self.debugreports = DebugReports(model)
> +        self.plugins = Plugins(model)
>           self.api_schema = json.load(open(get_api_schema_file()))
>
>       def error_production_handler(status, message, traceback, version):
> -- 


-- 
Sheldon Feng(冯少合)<shaohef at linux.vnet.ibm.com>
IBM Linux Technology Center




More information about the Kimchi-devel mailing list