From 63c778b76fe5406219e3beeaca3b17bb34b61133 Mon Sep 17 00:00:00 2001 From: Lenz Grimmer Date: Mon, 22 Jan 2018 13:39:29 +0100 Subject: [PATCH] mgr/dashboard_v2: Initial commit of the dashboard_v2 Manager module Create the directory and basic module initialization. Add a minimal `README.rst` Signed-off-by: Lenz Grimmer --- src/pybind/mgr/dashboard_v2/README.rst | 19 +++++++ src/pybind/mgr/dashboard_v2/__init__.py | 2 + src/pybind/mgr/dashboard_v2/module.py | 69 +++++++++++++++++++++++++ 3 files changed, 90 insertions(+) create mode 100644 src/pybind/mgr/dashboard_v2/README.rst create mode 100644 src/pybind/mgr/dashboard_v2/__init__.py create mode 100644 src/pybind/mgr/dashboard_v2/module.py diff --git a/src/pybind/mgr/dashboard_v2/README.rst b/src/pybind/mgr/dashboard_v2/README.rst new file mode 100644 index 00000000000..9d8bbd48fd1 --- /dev/null +++ b/src/pybind/mgr/dashboard_v2/README.rst @@ -0,0 +1,19 @@ +openATTIC Module for Ceph Manager +================================= + +This module is an ongoing project to convert the `openATTIC openATTIC Ceph +management and monitoring tool `_ (both the backend and +WebUI) into a Ceph Manager module. + +The current openATTIC backend implementation is based on Django and the Django +REST framework. The plan is to convert the backend code to use the CherryPy +framework and a custom REST API implementation instead. + +The current WebUI implementation is written using AngularJS 1.x JavaScript +framework. The upstream openATTIC project already has plans to move to +Angular/TypeScript; this migration will be performed at a later stage, once the +openATTIC mgr module has been accepted and is providing basic functionality. + +The porting of the existing openATTIC functionality will be done in stages. The +work is done by the openATTIC team and is currently tracked in the `openATTIC +JIRA `_. \ No newline at end of file diff --git a/src/pybind/mgr/dashboard_v2/__init__.py b/src/pybind/mgr/dashboard_v2/__init__.py new file mode 100644 index 00000000000..79f5b86fd50 --- /dev/null +++ b/src/pybind/mgr/dashboard_v2/__init__.py @@ -0,0 +1,2 @@ + +from module import * # NOQA diff --git a/src/pybind/mgr/dashboard_v2/module.py b/src/pybind/mgr/dashboard_v2/module.py new file mode 100644 index 00000000000..6c729e27a06 --- /dev/null +++ b/src/pybind/mgr/dashboard_v2/module.py @@ -0,0 +1,69 @@ +# -*- coding: utf-8 -*- + +""" +openATTIC mgr plugin (based on CherryPy) +""" + +import cherrypy +from cherrypy import tools + +from mgr_module import MgrModule + +""" +openATTIC CherryPy Module +""" + + +class Module(MgrModule): + + """ + Hello. + """ + + def __init__(self, *args, **kwargs): + super(Module, self).__init__(*args, **kwargs) + + def serve(self): + cherrypy.config.update({'server.socket_host': '0.0.0.0', + 'server.socket_port': 8080, + }) + cherrypy.tree.mount(Module.HelloWorld(self), "/") + cherrypy.engine.start() + cherrypy.engine.wait(state=cherrypy.engine.states.STOPPED) + + def shutdown(self): + cherrypy.engine.wait(state=cherrypy.engine.states.STARTED) + cherrypy.engine.stop() + + def handle_command(self, cmd): + pass + + class HelloWorld(object): + + """ + + Hello World. + + """ + + def __init__(self, module): + self.module = module + self.log = module.log + self.log.warn("Initiating WebServer CherryPy") + + @cherrypy.expose + def index(self): + """ + WS entrypoint + """ + + return "Hello World!" + + @cherrypy.expose + @tools.json_out() + def ping(self): + """ + Ping endpoint + """ + + return "pong" -- 2.39.5