]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: Disable sso without python3-saml 38405/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:36:00 +0000 (16:36 +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 adab60d5190a524837f9aa40b22106a55b1ab6bb..534d9fb997001e8b9cb4e7ec9f7a6b0b96eb4961 100644 (file)
@@ -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.', ''