From: Varsha Rao Date: Sat, 10 Apr 2021 07:38:56 +0000 (+0530) Subject: mgr/nfs: Check if transport or protocol are list instance X-Git-Tag: v16.2.5~105^2~11 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=739f4d3480d0b79aa5ab123d684dba07ba39f96c;p=ceph.git mgr/nfs: Check if transport or protocol are list instance This is to fix "int object is not iterableā€ error. Signed-off-by: Varsha Rao (cherry picked from commit ef4d7d7f2c6faa4d755d2da9d5f0fd88c9f81c09) --- diff --git a/src/pybind/mgr/nfs/export/export_utils.py b/src/pybind/mgr/nfs/export/export_utils.py index e7a9343d1050..2cfe00f8220b 100644 --- a/src/pybind/mgr/nfs/export/export_utils.py +++ b/src/pybind/mgr/nfs/export/export_utils.py @@ -261,6 +261,14 @@ class Export: client_blocks = [b for b in export_block['_blocks_'] if b['block_name'] == "CLIENT"] + protocols = export_block.get('protocols') + if not isinstance(protocols, list): + protocols = [protocols] + + transports = export_block.get('transports') + if not isinstance(transports, list): + transports = [transports] + return cls(export_block['export_id'], export_block['path'], cluster_id, @@ -268,8 +276,8 @@ class Export: export_block['access_type'], export_block['squash'], export_block['security_label'], - export_block['protocols'], - export_block['transports'], + protocols, + transports, CephFSFSal.from_fsal_block(fsal_block[0]), [Client.from_client_block(client) for client in client_blocks])