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
@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
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(
# 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'] = ""
"""
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):
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
@UiApiController('/cephfs', Scope.CEPHFS)
+@ControllerDoc("Dashboard UI helper function; not part of the public API", "CephFSUi")
class CephFsUi(CephFS):
RESOURCE_ID = 'fs_id'
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