]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/pybind/mgr/dashboard/controllers/cephfs.py
import 15.2.5
[ceph.git] / ceph / src / pybind / mgr / dashboard / controllers / cephfs.py
index d482ee6de37cf8b81f256f848fb9958c0d8f331c..499fae94612ce4a2367417637aff0b234afb0a9e 100644 (file)
@@ -8,7 +8,7 @@ import os
 import cherrypy
 import cephfs
 
-from . import ApiController, RESTController, UiApiController
+from . import ApiController, ControllerDoc, RESTController, UiApiController
 from .. import mgr
 from ..exceptions import DashboardException
 from ..security import Scope
@@ -19,7 +19,7 @@ from ..tools import ViewCache
 
 @ApiController('/cephfs', Scope.CEPHFS)
 class CephFS(RESTController):
-    def __init__(self):
+    def __init__(self):  # pragma: no cover
         super(CephFS, self).__init__()
 
         # Stateful instances of CephFSClients, hold cached results.  Key to
@@ -179,7 +179,7 @@ class CephFS(RESTController):
                                                     info['name'],
                                                     "mds_server.handle_client_request")
                 else:
-                    activity = 0.0
+                    activity = 0.0  # pragma: no cover
 
                 self._append_mds_metadata(mds_versions, info['name'])
                 rank_table.append(
@@ -285,15 +285,15 @@ class CephFS(RESTController):
         # indepdendent of whether it's a kernel or userspace
         # client, so that the javascript doesn't have to grok that.
         for client in clients:
-            if "ceph_version" in client['client_metadata']:
+            if "ceph_version" in client['client_metadata']:  # pragma: no cover - no complexity
                 client['type'] = "userspace"
                 client['version'] = client['client_metadata']['ceph_version']
                 client['hostname'] = client['client_metadata']['hostname']
-            elif "kernel_version" in client['client_metadata']:
+            elif "kernel_version" in client['client_metadata']:  # pragma: no cover - no complexity
                 client['type'] = "kernel"
                 client['version'] = client['client_metadata']['kernel_version']
                 client['hostname'] = client['client_metadata']['hostname']
-            else:
+            else:  # pragma: no cover - no complexity there
                 client['type'] = "unknown"
                 client['version'] = ""
                 client['hostname'] = ""
@@ -334,7 +334,7 @@ class CephFS(RESTController):
         """
         try:
             return self._get_root_directory(self._cephfs_instance(fs_id))
-        except (cephfs.PermissionError, cephfs.ObjectNotFound):
+        except (cephfs.PermissionError, cephfs.ObjectNotFound):  # pragma: no cover
             return None
 
     def _get_root_directory(self, cfs):
@@ -365,7 +365,7 @@ class CephFS(RESTController):
         try:
             cfs = self._cephfs_instance(fs_id)
             paths = cfs.ls_dir(path, depth)
-        except (cephfs.PermissionError, cephfs.ObjectNotFound):
+        except (cephfs.PermissionError, cephfs.ObjectNotFound):  # pragma: no cover
             paths = []
         return paths
 
@@ -467,6 +467,7 @@ class CephFSClients(object):
 
 
 @UiApiController('/cephfs', Scope.CEPHFS)
+@ControllerDoc("Dashboard UI helper function; not part of the public API", "CephFSUi")
 class CephFsUi(CephFS):
     RESOURCE_ID = 'fs_id'
 
@@ -515,6 +516,6 @@ class CephFsUi(CephFS):
             paths = cfs.ls_dir(path, depth)
             if path == os.sep:
                 paths = [self._get_root_directory(cfs)] + paths
-        except (cephfs.PermissionError, cephfs.ObjectNotFound):
+        except (cephfs.PermissionError, cephfs.ObjectNotFound):  # pragma: no cover
             paths = []
         return paths