]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard_v2: Initial commit of the dashboard_v2 Manager module
authorLenz Grimmer <lenz@grimmer.com>
Mon, 22 Jan 2018 12:39:29 +0000 (13:39 +0100)
committerRicardo Dias <rdias@suse.com>
Mon, 5 Mar 2018 13:06:57 +0000 (13:06 +0000)
Create the directory and basic module initialization.

Add a minimal `README.rst`

Signed-off-by: Lenz Grimmer <lgrimmer@suse.com>
src/pybind/mgr/dashboard_v2/README.rst [new file with mode: 0644]
src/pybind/mgr/dashboard_v2/__init__.py [new file with mode: 0644]
src/pybind/mgr/dashboard_v2/module.py [new file with mode: 0644]

diff --git a/src/pybind/mgr/dashboard_v2/README.rst b/src/pybind/mgr/dashboard_v2/README.rst
new file mode 100644 (file)
index 0000000..9d8bbd4
--- /dev/null
@@ -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 <https://openattic.org/>`_ (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 <https://tracker.openattic.org/browse/OP-3039>`_.
\ 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 (file)
index 0000000..79f5b86
--- /dev/null
@@ -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 (file)
index 0000000..6c729e2
--- /dev/null
@@ -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"