]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: Disable sso without python3-saml 38404/head
authorKevin Meijer <kevinmeijer@brightfish.nl>
Sat, 14 Nov 2020 18:44:07 +0000 (19:44 +0100)
committerLaura Paduano <lpaduano@suse.com>
Wed, 2 Dec 2020 15:35:13 +0000 (16:35 +0100)
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 <admin@kevinmeijer.nl>
(cherry picked from commit 0c18437d2c786ef1ade8b89e42dbf4b0e163aafe)

src/pybind/mgr/dashboard/services/sso.py

index 9810aa43a0f05938fb5896d2a1bd5c7448bae406..007a53078da993bc4100c0bea950d5ee6e61daf2 100644 (file)
@@ -140,6 +140,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:
         python_saml_name = 'python3-saml' if sys.version_info >= (3, 0) else 'python-saml'
         return -errno.EPERM, '', 'Required library not found: `{}`'.format(python_saml_name)
@@ -154,11 +159,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.', ''