From ac60f6104ffe147c9d7f625e772d28ff44ca649d Mon Sep 17 00:00:00 2001 From: Varsha Rao Date: Wed, 12 May 2021 22:24:40 +0530 Subject: [PATCH] mgr/nfs: annotate _cmd_nfs_* methods return value Fixes: 7c57d1634 Fixes: https://tracker.ceph.com/issues/50783 Signed-off-by: Varsha Rao (cherry picked from commit 1ec90c804319b32d86212f7402cac93fb14cb1d2) --- src/pybind/mgr/nfs/module.py | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/pybind/mgr/nfs/module.py b/src/pybind/mgr/nfs/module.py index e4761a7d2255e..9d9371f4619e2 100644 --- a/src/pybind/mgr/nfs/module.py +++ b/src/pybind/mgr/nfs/module.py @@ -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 `""" # The export 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 `""" 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) -- 2.39.5