summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvamahaja <vamahaja@redhat.com>2020-01-08 11:06:46 +0530
committerVaibhav Mahajan <vamahaja@redhat.com>2020-01-14 07:35:32 +0000
commit525601e334368de09cdf892b9002e903b3f9cbd6 (patch)
treec2644c7315cd43f4dfdd8268780e2384789d3d4e
parent225ac295bf630189fac4c51d4a359c6024f23625 (diff)
Add check for 'json' param in function 'get_block_hosting_volume_list'
'get_block_hosting_volume_list' will get failed in case user pass 'json=True' value as this function works on raw output of 'heketi_volume_list'. Add code to pop 'json' param in case user pass 'json=True' value. Change-Id: Iad053762fd1fa0c25bc4d01c038d20450e29676c Signed-off-by: vamahaja <vamahaja@redhat.com>
-rw-r--r--openshift-storage-libs/openshiftstoragelibs/heketi_ops.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/openshift-storage-libs/openshiftstoragelibs/heketi_ops.py b/openshift-storage-libs/openshiftstoragelibs/heketi_ops.py
index df00dbf..6b08b5d 100644
--- a/openshift-storage-libs/openshiftstoragelibs/heketi_ops.py
+++ b/openshift-storage-libs/openshiftstoragelibs/heketi_ops.py
@@ -1573,16 +1573,17 @@ def get_block_hosting_volume_list(
Raises:
exceptions.ExecutionError: if command fails.
"""
+ # Delete json key from kwargs
+ kwargs.pop("json", None)
- out = heketi_volume_list(
+ volume_list = heketi_volume_list(
heketi_client_node, heketi_server_url, **kwargs)
- BHV = {}
-
- for volume in HEKETI_BHV.findall(out.strip()):
- BHV[volume[0]] = {'Cluster': volume[1], 'Name': volume[2]}
+ bhv = {
+ volume[0]: {"Cluster": volume[1], "Name": volume[2]}
+ for volume in HEKETI_BHV.findall(volume_list.strip())}
- return BHV
+ return bhv
def get_total_free_space(heketi_client_node, heketi_server_url):