From: Jeff Layton Date: Fri, 18 Jan 2019 17:15:18 +0000 (-0500) Subject: mgr/rook: wrap url fetch function in try/except block X-Git-Tag: v14.1.0~318^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F26032%2Fhead;p=ceph.git mgr/rook: wrap url fetch function in try/except block It's possible for the fetch of this object to fail if the service is being torn down. Handle that situation gracefully, but log a message. Signed-off-by: Jeff Layton --- diff --git a/src/pybind/mgr/rook/rook_cluster.py b/src/pybind/mgr/rook/rook_cluster.py index 1b0dbe2bad40..862f62346346 100644 --- a/src/pybind/mgr/rook/rook_cluster.py +++ b/src/pybind/mgr/rook/rook_cluster.py @@ -106,9 +106,15 @@ class RookCluster(object): def get_nfs_conf_url(self, nfs_cluster, instance): # # Fetch cephnfs object for "nfs_cluster" and then return a rados:// - # URL for the instance within that cluster. + # URL for the instance within that cluster. If the fetch fails, just + # return None. # - ceph_nfs = self.rook_api_get("cephnfses/{0}".format(nfs_cluster)) + try: + ceph_nfs = self.rook_api_get("cephnfses/{0}".format(nfs_cluster)) + except ApiException as e: + log.info("Unable to fetch cephnfs object: {}".format(e.status)) + return None + pool = ceph_nfs['spec']['rados']['pool'] namespace = ceph_nfs['spec']['rados'].get('namespace', None)