]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: Add separate option to config SSL port 27393/head
authorVolker Theile <vtheile@suse.com>
Tue, 12 Mar 2019 13:12:55 +0000 (14:12 +0100)
committerTatjana Dehler <tdehler@suse.com>
Fri, 5 Apr 2019 10:25:35 +0000 (12:25 +0200)
There is a need to introduce this new config option because the MgrModule::get_module_option() and MgrModule::get_localized_module_option() method will be refactored soon and will not support the default parameter anymore. Instead the default value must be configured in the MODULE_OPTIONS. Currently we misuse the server_port depending on if SSL is enabled or not.

Fixes: https://tracker.ceph.com/issues/38331
Signed-off-by: Volker Theile <vtheile@suse.com>
(cherry picked from commit 86f47f6bfda6c2d45c97801a522a200225abc3d4)

doc/mgr/dashboard.rst
qa/tasks/mgr/dashboard/helper.py
qa/tasks/mgr/test_dashboard.py
qa/tasks/mgr/test_module_selftest.py
src/pybind/mgr/dashboard/module.py

index a557d43eecf42ead985b8992afcc5ab5d64d1f8c..9d99f25ee451737c76cf16ee3813de5b5694d46b 100644 (file)
@@ -220,6 +220,7 @@ cluster-wide level (so they apply to all manager instances) as follows::
 
   $ ceph config set mgr mgr/dashboard/server_addr $IP
   $ ceph config set mgr mgr/dashboard/server_port $PORT
+  $ ceph config set mgr mgr/dashboard/ssl_server_port $PORT
 
 Since each ``ceph-mgr`` hosts its own instance of dashboard, it may also be
 necessary to configure them separately. The IP address and port for a specific
@@ -227,6 +228,7 @@ manager instance can be changed with the following commands::
 
   $ ceph config set mgr mgr/dashboard/$name/server_addr $IP
   $ ceph config set mgr mgr/dashboard/$name/server_port $PORT
+  $ ceph config set mgr mgr/dashboard/$name/ssl_server_port $PORT
 
 Replace ``$name`` with the ID of the ceph-mgr instance hosting the dashboard web
 app.
index a0beee32a403c8f25513ce9e46bff0fb7201187a..454d86249fa568073fca8d39faf7df86b8508122 100644 (file)
@@ -110,7 +110,7 @@ class DashboardTestCase(MgrTestCase):
     @classmethod
     def setUpClass(cls):
         super(DashboardTestCase, cls).setUpClass()
-        cls._assign_ports("dashboard", "server_port")
+        cls._assign_ports("dashboard", "ssl_server_port")
         cls._load_module("dashboard")
         cls._base_uri = cls._get_uri("dashboard").rstrip('/')
 
index 44d632b1f3822d1213aa02d3e2fb3091fe208a5b..3b778520da872f93f15aea1f28151b3b56e358de 100644 (file)
@@ -15,7 +15,7 @@ class TestDashboard(MgrTestCase):
     def setUp(self):
         super(TestDashboard, self).setUp()
 
-        self._assign_ports("dashboard", "server_port")
+        self._assign_ports("dashboard", "ssl_server_port")
         self._load_module("dashboard")
         self.mgr_cluster.mon_manager.raw_cluster_cmd("dashboard",
                                                      "create-self-signed-cert")
index 6a43ff5e316b636320928b4ca51fcecf5f2c7646..7e6a5110c9dce28e597e5bc87833561bf1577c22 100644 (file)
@@ -192,7 +192,7 @@ class TestModuleSelftest(MgrTestCase):
         self._load_module("selftest")
 
         # Use the dashboard to test that the mgr is still able to do its job
-        self._assign_ports("dashboard", "server_port")
+        self._assign_ports("dashboard", "ssl_server_port")
         self._load_module("dashboard")
         self.mgr_cluster.mon_manager.raw_cluster_cmd("dashboard",
                                                      "create-self-signed-cert")
index b236a1ac024adb073ca3b59c0c641e4d9c33be82..a8a3ec07c1ca203cbf103d91c3765749c4f6f378 100644 (file)
@@ -16,8 +16,6 @@ from uuid import uuid4
 from OpenSSL import crypto
 from mgr_module import MgrModule, MgrStandbyModule, Option
 
-from .tools import str_to_bool
-
 try:
     import cherrypy
     from cherrypy._cptools import HandlerWrapperTool
@@ -126,19 +124,19 @@ class CherryPyConfig(object):
         :returns our URI
         """
         server_addr = self.get_localized_module_option('server_addr', '::')
-        ssl = str_to_bool(self.get_localized_module_option('ssl', 'True'))
-        def_server_port = 8443
+        ssl = self.get_localized_module_option('ssl', True)
         if not ssl:
-            def_server_port = 8080
+            server_port = self.get_localized_module_option('server_port', 8080)
+        else:
+            server_port = self.get_localized_module_option('ssl_server_port', 8443)
 
-        server_port = self.get_localized_module_option('server_port', def_server_port)
         if server_addr is None:
             raise ServerConfigException(
                 'no server_addr configured; '
                 'try "ceph config set mgr mgr/{}/{}/server_addr <ip>"'
                 .format(self.module_name, self.get_mgr_id()))
-        self.log.info('server_addr: %s server_port: %s', server_addr,
-                      server_port)
+        self.log.info('server: ssl=%s host=%s port=%d', 'yes' if ssl else 'no',
+                      server_addr, server_port)
 
         # Initialize custom handlers.
         cherrypy.tools.authenticate = AuthManagerTool()
@@ -265,7 +263,8 @@ class Module(MgrModule, CherryPyConfig):
 
     MODULE_OPTIONS = [
         Option(name='server_addr', type='str', default='::'),
-        Option(name='server_port', type='int', default=8443),
+        Option(name='server_port', type='int', default=8080),
+        Option(name='ssl_server_port', type='int', default=8443),
         Option(name='jwt_token_ttl', type='int', default=28800),
         Option(name='password', type='str', default=''),
         Option(name='url_prefix', type='str', default=''),