]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/dashboard: Disable sso without python3-saml
authorKevin Meijer <kevinmeijer@brightfish.nl>
Sat, 14 Nov 2020 18:44:07 +0000 (19:44 +0100)
committerKevin Meijer <kevinmeijer@brightfish.nl>
Mon, 16 Nov 2020 14:03:02 +0000 (15:03 +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>
src/pybind/mgr/dashboard/services/sso.py

index ac19180bddc2cc6e16b537ebd15e20235a880ae6..f2f2a6a7da5b4b2def13aa620f3c3fb8ee1dbf60 100644 (file)
@@ -144,6 +144,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`'
 
@@ -157,11 +162,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.', ''