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
"""
return cfs.get_directory(os.sep.encode())
+ @handle_cephfs_error()
@RESTController.Resource('GET')
def ls_dir(self, fs_id, path=None, depth=1):
"""
return data
+ @handle_cephfs_error()
@RESTController.Resource('GET')
def ls_dir(self, fs_id, path=None, depth=1):
"""
import logging
from contextlib import contextmanager
+import cephfs
import cherrypy
import rados
import rbd
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: