]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/nfs: annotate _cmd_nfs_* methods return value
authorVarsha Rao <varao@redhat.com>
Wed, 12 May 2021 16:54:40 +0000 (22:24 +0530)
committerVarsha Rao <varao@redhat.com>
Thu, 20 May 2021 05:39:05 +0000 (11:09 +0530)
Fixes: 7c57d1634
Fixes: https://tracker.ceph.com/issues/50783
Signed-off-by: Varsha Rao <varao@redhat.com>
(cherry picked from commit 1ec90c804319b32d86212f7402cac93fb14cb1d2)

src/pybind/mgr/nfs/module.py

index e4761a7d2255e5d9d059ae041adf10592f1b2d35..9d9371f4619e2d39706957c82ac4785a09155e7a 100644 (file)
@@ -1,5 +1,6 @@
 import logging
 import threading
+from typing import Tuple
 
 from mgr_module import MgrModule, CLICommand
 import orchestrator
@@ -24,7 +25,7 @@ class Module(orchestrator.OrchestratorClientMixin, MgrModule):
 
     @CLICommand('nfs export create cephfs', perm='rw')
     def _cmd_nfs_export_create_cephfs(self, fsname: str, clusterid: str, binding: str,
-                                      readonly: bool=False, path: str='/'):
+                                      readonly: bool=False, path: str='/') -> Tuple[int, str, str]:
         """Create a cephfs export"""
         # TODO Extend export creation for rgw.
         return self.export_mgr.create_export(fsal_type='cephfs', fs_name=fsname,
@@ -32,57 +33,57 @@ class Module(orchestrator.OrchestratorClientMixin, MgrModule):
                                              read_only=readonly, path=path)
 
     @CLICommand('nfs export delete', perm='rw')
-    def _cmd_nfs_export_delete(self, clusterid: str, binding: str):
+    def _cmd_nfs_export_delete(self, clusterid: str, binding: str) -> Tuple[int, str, str]:
         """Delete a cephfs export"""
         return self.export_mgr.delete_export(cluster_id=clusterid, pseudo_path=binding)
 
     @CLICommand('nfs export ls', perm='r')
-    def _cmd_nfs_export_ls(self, clusterid: str, detailed: bool=False):
+    def _cmd_nfs_export_ls(self, clusterid: str, detailed: bool=False) -> Tuple[int, str, str]:
         """List exports of a NFS cluster"""
         return self.export_mgr.list_exports(cluster_id=clusterid, detailed=detailed)
 
     @CLICommand('nfs export get', perm='r')
-    def _cmd_nfs_export_get(self, clusterid: str, binding: str):
+    def _cmd_nfs_export_get(self, clusterid: str, binding: str) -> Tuple[int, str, str]:
         """Fetch a export of a NFS cluster given the pseudo path/binding"""
         return self.export_mgr.get_export(cluster_id=clusterid, pseudo_path=binding)
 
     @CLICommand('nfs export update', perm='rw')
-    def _cmd_nfs_export_update(self, inbuf: str):
+    def _cmd_nfs_export_update(self, inbuf: str) -> Tuple[int, str, str]:
         """Update an export of a NFS cluster by `-i <json_file>`"""
         # The export <json_file> is passed to -i and it's processing is handled by the Ceph CLI.
         return self.export_mgr.update_export(export_config=inbuf)
 
     @CLICommand('nfs cluster create', perm='rw')
-    def _cmd_nfs_cluster_create(self, clusterid: str, placement: str=None):
+    def _cmd_nfs_cluster_create(self, clusterid: str, placement: str=None) -> Tuple[int, str, str]:
         """Create an NFS Cluster"""
         return self.nfs.create_nfs_cluster(cluster_id=clusterid, placement=placement)
 
     @CLICommand('nfs cluster update', perm='rw')
-    def _cmd_nfs_cluster_update(self, clusterid: str, placement: str):
+    def _cmd_nfs_cluster_update(self, clusterid: str, placement: str) -> Tuple[int, str, str]:
         """Updates an NFS Cluster"""
         return self.nfs.update_nfs_cluster(cluster_id=clusterid, placement=placement)
 
     @CLICommand('nfs cluster delete', perm='rw')
-    def _cmd_nfs_cluster_delete(self, clusterid: str):
+    def _cmd_nfs_cluster_delete(self, clusterid: str) -> Tuple[int, str, str]:
         """Deletes an NFS Cluster"""
         return self.nfs.delete_nfs_cluster(cluster_id=clusterid)
 
     @CLICommand('nfs cluster ls', perm='r')
-    def _cmd_nfs_cluster_ls(self):
+    def _cmd_nfs_cluster_ls(self) -> Tuple[int, str, str]:
         """List NFS Clusters"""
         return self.nfs.list_nfs_cluster()
 
     @CLICommand('nfs cluster info', perm='r')
-    def _cmd_nfs_cluster_info(self, clusterid: str=None):
+    def _cmd_nfs_cluster_info(self, clusterid: str=None) -> Tuple[int, str, str]:
         """Displays NFS Cluster info"""
         return self.nfs.show_nfs_cluster_info(cluster_id=clusterid)
 
     @CLICommand('nfs cluster config set', perm='rw')
-    def _cmd_nfs_cluster_config_set(self, clusterid: str, inbuf: str):
+    def _cmd_nfs_cluster_config_set(self, clusterid: str, inbuf: str) -> Tuple[int, str, str]:
         """Set NFS-Ganesha config by `-i <config_file>`"""
         return self.nfs.set_nfs_cluster_config(cluster_id=clusterid, nfs_config=inbuf)
 
     @CLICommand('nfs cluster config reset', perm='rw')
-    def _cmd_nfs_cluster_config_reset(self, clusterid: str):
+    def _cmd_nfs_cluster_config_reset(self, clusterid: str) -> Tuple[int, str, str]:
         """Reset NFS-Ganesha Config to default"""
         return self.nfs.reset_nfs_cluster_config(cluster_id=clusterid)