Merge pull request #30478 from votdev/issue_41930_standby_dashboard

mgr/dashboard: Standby Dashboards don't handle all requests properly

Reviewed-by: Alfonso Martínez <almartin@redhat.com>
This commit is contained in:
Lenz Grimmer 2019-09-27 09:37:37 +00:00 committed by GitHub
commit 2f4c2440e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 2 deletions

View File

@ -49,11 +49,18 @@ class TestDashboard(MgrTestCase):
self.assertNotEqual(original_uri, failed_over_uri)
# The original active daemon should have come back up as a standby
# and be doing redirects to the new active daemon
# and be doing redirects to the new active daemon.
r = requests.get(original_uri, allow_redirects=False, verify=False)
self.assertEqual(r.status_code, 303)
self.assertEqual(r.headers['Location'], failed_over_uri)
# Ensure that every URL redirects to the active daemon.
r = requests.get("{}/runtime.js".format(original_uri),
allow_redirects=False,
verify=False)
self.assertEqual(r.status_code, 303)
self.assertEqual(r.headers['Location'], failed_over_uri)
def test_standby_disable_redirect(self):
self.mgr_cluster.mon_manager.raw_cluster_cmd("config", "set", "mgr",
"mgr/dashboard/standby_behaviour",

View File

@ -473,7 +473,7 @@ class StandbyModule(MgrStandbyModule, CherryPyConfig):
class Root(object):
@cherrypy.expose
def index(self):
def default(self, *args, **kwargs):
if module.get_module_option('standby_behaviour', 'redirect') == 'redirect':
active_uri = module.get_active_uri()
if active_uri: