summaryrefslogtreecommitdiffstats
path: root/glustolibs-gluster/glustolibs/gluster
diff options
context:
space:
mode:
authorkshithijiyer <kshithij.ki@gmail.com>2020-04-21 21:48:27 +0530
committerkshithijiyer <kshithij.ki@gmail.com>2020-04-21 21:54:03 +0530
commit72ae049a49aebf108c3ca1ec63a38aa286533f52 (patch)
treecea29742fc108cb30955174f648ad6e2bd5b28fb /glustolibs-gluster/glustolibs/gluster
parenta493ce9eb3df82e48d6bbb7738ae3ae8aa26242c (diff)
[Libfix] Fix .next() to work with python 3
Problem: item.next() is not supported in python 3. Solution: Add try except block to take care of both python 2 and python 3. Change-Id: I4c88804e45eee2a2ace24a982447000027e6ca3c Signed-off-by: kshithijiyer <kshithij.ki@gmail.com>
Diffstat (limited to 'glustolibs-gluster/glustolibs/gluster')
-rw-r--r--glustolibs-gluster/glustolibs/gluster/brickmux_libs.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/glustolibs-gluster/glustolibs/gluster/brickmux_libs.py b/glustolibs-gluster/glustolibs/gluster/brickmux_libs.py
index 1206b46..cb82d84 100644
--- a/glustolibs-gluster/glustolibs/gluster/brickmux_libs.py
+++ b/glustolibs-gluster/glustolibs/gluster/brickmux_libs.py
@@ -66,7 +66,10 @@ def get_all_bricks_from_servers_multivol(servers, servers_info):
for item in list(zip_longest(*list(servers_bricks.values()))):
for brick in item:
- server = server_ip.next()
+ try:
+ server = server_ip.next() # Python 2
+ except AttributeError:
+ server = next(server_ip) # Python 3
if brick:
bricks_list.append(server + ":" + brick)
brickCount += 1