[Kimchi-devel] [PATCH V3 4/4] improve controller: set authentication automatically

Aline Manera alinefm at linux.vnet.ibm.com
Thu Jan 23 20:03:08 UTC 2014


On 01/22/2014 02:51 PM, shaohef at linux.vnet.ibm.com wrote:
> From: ShaoHe Feng <shaohef at linux.vnet.ibm.com>
>
> Remove hard code from server.py.
> We do not need to touch root.py any more when we add a new sub

Ops... It should be server.py instead of root.py

> collection/resouce.
>
> Signed-off-by: ShaoHe Feng <shaohef at linux.vnet.ibm.com>
> ---
>   src/kimchi/server.py | 12 +++++-------
>   1 file changed, 5 insertions(+), 7 deletions(-)
>
> diff --git a/src/kimchi/server.py b/src/kimchi/server.py
> index b820263..2a9f53f 100644
> --- a/src/kimchi/server.py
> +++ b/src/kimchi/server.py
> @@ -33,6 +33,7 @@ from kimchi import config
>   from kimchi import model
>   from kimchi import mockmodel
>   from kimchi import vnc
> +from kimchi.control import sub_nodes
>   from kimchi.root import Root
>   from kimchi.utils import get_enabled_plugins, import_class
>
> @@ -74,13 +75,6 @@ class Server(object):
>                 'tools.sessions.storage_type': 'file',
>                 'tools.sessions.storage_path': config.get_session_path(),
>                 'tools.kimchiauth.on': False},
> -        '/host': {'tools.kimchiauth.on': True},
> -        '/vms': {'tools.kimchiauth.on': True},
> -        '/templates': {'tools.kimchiauth.on': True},
> -        '/networks': {'tools.kimchiauth.on': True},
> -        '/storagepools': {'tools.kimchiauth.on': True},
> -        '/tasks': {'tools.kimchiauth.on': True},
> -        '/debugreports': {'tools.kimchiauth.on': True},
>           '/css': {
>               'tools.staticdir.on': True,
>               'tools.staticdir.dir': 'ui/css',
> @@ -193,6 +187,10 @@ class Server(object):
>               vnc_ws_proxy = vnc.new_ws_proxy()
>               cherrypy.engine.subscribe('exit', vnc_ws_proxy.kill)
>
> +        for ident, node in sub_nodes.items():
> +            if node.url_auth:
> +                self.configObj["/%s" % ident] = {'tools.kimchiauth.on': True}
> +
>           self.app = cherrypy.tree.mount(Root(model_instance, dev_env),
>                                          config=self.configObj)
>           self._load_plugins()




More information about the Kimchi-devel mailing list