From ec7fcf1ec487f0b66e45770bfacad1a2bdcf957f Mon Sep 17 00:00:00 2001 From: Matthew Stidham Date: Wed, 29 Dec 2021 12:19:55 -0800 Subject: [PATCH] Realm.wait_for_ip: We only need to checik that stas_without_ips and stas_without_ip6s are equal to zero once, simplify code further Signed-off-by: Matthew Stidham --- py-json/realm.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/py-json/realm.py b/py-json/realm.py index 7b410740..e180e6a3 100755 --- a/py-json/realm.py +++ b/py-json/realm.py @@ -655,9 +655,7 @@ class Realm(LFCliBase): else: if debug: print("Found IP: %s on port: %s" % (v['ip'], sta_eid)) - if len(stas_without_ip4s) == 0 and not ipv6: - print('Found IPs for all requested ports') - return True + if ipv6: v = response['interface'] ip6a = v['ipv6_address'] @@ -668,14 +666,10 @@ class Realm(LFCliBase): stas_without_ip6s[sta_eid] = True if debug: print("Waiting for port %s to get IPv6 Address try %s / %s, reported: %s." % (sta_eid, sec_elapsed, timeout_sec, ip6a)) - if len(stas_without_ip6s) == 0 and not ipv4: - print('Found IPs for all requested ports') - return True - if ipv4 and ipv6: - if len(stas_without_ip4s) == len(stas_without_ip6s) == 0: - print('Found IPs for all requested ports') - return True + if len(stas_without_ip4s) == len(stas_without_ip6s) == 0: + print('Found IPs for all requested ports') + return True time.sleep(1) sec_elapsed += 1