From c2c0f7a85f10e3c5da27b4a7bea5a35ca237af8b Mon Sep 17 00:00:00 2001 From: Kevin Meijer Date: Sat, 14 Nov 2020 19:44:07 +0100 Subject: [PATCH] mgr/dashboard: Disable sso without python3-saml Removed the requirement for the python3-saml package when wanting to disable SSO for the dashboard, this is currently relevant since the official container that runs Ceph mgr does not have this package installed. So when upgrading from an older, non-containerized version, you would be stuck using a non-functional dashboard. This pull requests changes that and allows the ceph dashboard sso disable command without the requirement of the library so that we SSO can always be disabled again. Fixes: https://tracker.ceph.com/issues/48237 Signed-off-by: Kevin Meijer (cherry picked from commit 0c18437d2c786ef1ade8b89e42dbf4b0e163aafe) --- src/pybind/mgr/dashboard/services/sso.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/pybind/mgr/dashboard/services/sso.py b/src/pybind/mgr/dashboard/services/sso.py index adab60d5190a5..534d9fb997001 100644 --- a/src/pybind/mgr/dashboard/services/sso.py +++ b/src/pybind/mgr/dashboard/services/sso.py @@ -150,6 +150,11 @@ def handle_sso_command(cmd): 'dashboard sso setup saml2']: return -errno.ENOSYS, '', '' + if cmd['prefix'] == 'dashboard sso disable': + mgr.SSO_DB.protocol = '' + mgr.SSO_DB.save() + return 0, 'SSO is "disabled".', '' + if not python_saml_imported: return -errno.EPERM, '', 'Required library not found: `python3-saml`' @@ -163,11 +168,6 @@ def handle_sso_command(cmd): mgr.SSO_DB.save() return 0, 'SSO is "enabled" with "SAML2" protocol.', '' - if cmd['prefix'] == 'dashboard sso disable': - mgr.SSO_DB.protocol = '' - mgr.SSO_DB.save() - return 0, 'SSO is "disabled".', '' - if cmd['prefix'] == 'dashboard sso status': if mgr.SSO_DB.protocol == 'saml2': return 0, 'SSO is "enabled" with "SAML2" protocol.', '' -- 2.47.3