]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: NFS pages shows 'Page not found' 45723/head
authorVolker Theile <vtheile@suse.com>
Mon, 10 Jan 2022 11:16:20 +0000 (12:16 +0100)
committerNizamudeen A <nia@redhat.com>
Thu, 31 Mar 2022 07:04:32 +0000 (12:34 +0530)
Fixes: https://tracker.ceph.com/issues/53813
Signed-off-by: Volker Theile <vtheile@suse.com>
(cherry picked from commit f6e99ee05a2f5ff145736014aeb5184cdc8259bb)

src/pybind/mgr/dashboard/controllers/nfs.py
src/pybind/mgr/dashboard/tests/test_nfs.py

index 9985ba11d34638c81376c872bf90324cd34315dc..17221dbcb6eef986987d7704bbdecce6b60ef78d 100644 (file)
@@ -97,7 +97,7 @@ class NFSGanesha(RESTController):
         status = {'available': True, 'message': None}
         try:
             mgr.remote('nfs', 'cluster_ls')
-        except ImportError as error:
+        except (ImportError, RuntimeError) as error:
             logger.exception(error)
             status['available'] = False
             status['message'] = str(error)  # type: ignore
index 087ca18914b95c781b8b6a150ed140e0b28fd7a4..c0103653f96d66beb17c3d95ebed7f66f3b9c496 100644 (file)
@@ -6,7 +6,7 @@ from urllib.parse import urlencode
 
 from .. import mgr
 from ..controllers._version import APIVersion
-from ..controllers.nfs import NFSGaneshaExports, NFSGaneshaUi
+from ..controllers.nfs import NFSGanesha, NFSGaneshaExports, NFSGaneshaUi
 from ..tests import ControllerTestCase
 from ..tools import NotificationQueue, TaskManager
 
@@ -227,3 +227,20 @@ class NFSGaneshaUiControllerTest(ControllerTestCase):
         cephfs_class.return_value.ls_dir.assert_called_once_with('/foo', 3)
         self.assertStatus(200)
         self.assertJsonBody({'paths': []})
+
+
+class NFSGaneshaControllerTest(ControllerTestCase):
+    @classmethod
+    def setup_server(cls):
+        cls.setup_controllers([NFSGanesha])
+
+    def test_status_available(self):
+        self._get('/api/nfs-ganesha/status')
+        self.assertStatus(200)
+        self.assertJsonBody({'available': True, 'message': None})
+
+    def test_status_not_available(self):
+        mgr.remote = Mock(side_effect=RuntimeError('Test'))
+        self._get('/api/nfs-ganesha/status')
+        self.assertStatus(200)
+        self.assertJsonBody({'available': False, 'message': 'Test'})