]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/nfs: handle bad cluster name during info command
authordparmar18 <dparmar@redhat.com>
Thu, 1 Dec 2022 09:57:32 +0000 (15:27 +0530)
committerdparmar18 <dparmar@redhat.com>
Fri, 6 Jan 2023 13:06:30 +0000 (18:36 +0530)
It should say the cluster does not exist

Fixes: https://tracker.ceph.com/issues/58138
Signed-off-by: Dhairya Parmar <dparmar@redhat.com>
(cherry picked from commit cddaef44ea85bf171ee5c87a8f7d2c098a16819b)

src/pybind/mgr/nfs/cluster.py

index 61bc477727baa5ba2d5e80c4697d512e7c4f4e23..d0adaa49d7dec217f9ee65d29c6a6aa0a8ec4e89 100644 (file)
@@ -201,6 +201,8 @@ class NFSCluster:
 
     def show_nfs_cluster_info(self, cluster_id: Optional[str] = None) -> Tuple[int, str, str]:
         try:
+            if cluster_id and cluster_id not in available_clusters(self.mgr):
+                raise ClusterNotFound()
             info_res = {}
             if cluster_id:
                 cluster_ls = [cluster_id]