From 72ae049a49aebf108c3ca1ec63a38aa286533f52 Mon Sep 17 00:00:00 2001 From: kshithijiyer Date: Tue, 21 Apr 2020 21:48:27 +0530 Subject: [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 --- glustolibs-gluster/glustolibs/gluster/brickmux_libs.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'glustolibs-gluster') diff --git a/glustolibs-gluster/glustolibs/gluster/brickmux_libs.py b/glustolibs-gluster/glustolibs/gluster/brickmux_libs.py index 1206b4682..cb82d8434 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 -- cgit