]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard:Directories Menu Can't Use on Ceph File System Dashboard 44849/head
authorSarthak0702 <sarthak.0702@gmail.com>
Thu, 3 Feb 2022 17:59:17 +0000 (23:29 +0530)
committerSarthak0702 <sarthak.0702@gmail.com>
Wed, 9 Feb 2022 11:59:37 +0000 (17:29 +0530)
Added exception handling to opendir() in cephfs.py for directories with no execute permission.

Fixes: https://tracker.ceph.com/issues/51611
Signed-off-by: Sarthak0702 <sarthak.0702@gmail.com>
src/pybind/mgr/dashboard/controllers/cephfs.py
src/pybind/mgr/dashboard/services/exception.py

index d32cbe4bcfab6b307b285c5e865126b5f685f884..5da79e35b48e1e75df2aae71992c24e59d920551 100644 (file)
@@ -10,6 +10,7 @@ from ..exceptions import DashboardException
 from ..security import Scope
 from ..services.ceph_service import CephService
 from ..services.cephfs import CephFS as CephFS_
+from ..services.exception import handle_cephfs_error
 from ..tools import ViewCache
 from . import APIDoc, APIRouter, EndpointDoc, RESTController, UIRouter, allow_empty_body
 
@@ -363,6 +364,7 @@ class CephFS(RESTController):
         """
         return cfs.get_directory(os.sep.encode())
 
+    @handle_cephfs_error()
     @RESTController.Resource('GET')
     def ls_dir(self, fs_id, path=None, depth=1):
         """
@@ -517,6 +519,7 @@ class CephFsUi(CephFS):
 
         return data
 
+    @handle_cephfs_error()
     @RESTController.Resource('GET')
     def ls_dir(self, fs_id, path=None, depth=1):
         """
index f027ed300b96a7bdcad0ff7c9048960467db3995..ba2a593cfb68c435fc0529c20e2361316bbb1049 100644 (file)
@@ -4,6 +4,7 @@ import json
 import logging
 from contextlib import contextmanager
 
+import cephfs
 import cherrypy
 import rados
 import rbd
@@ -55,6 +56,14 @@ def dashboard_exception_handler(handler, *args, **kwargs):
         raise error
 
 
+@contextmanager
+def handle_cephfs_error():
+    try:
+        yield
+    except cephfs.OSError as e:
+        raise DashboardException(e, component='cephfs') from e
+
+
 @contextmanager
 def handle_rbd_error():
     try: