Commit e5cc9c2c authored by Ilias Tsitsimpis's avatar Ilias Tsitsimpis
Browse files

Better handling of `delete_stale' in cleanup_networks

We should not check (and wait) for staled servers to
be deleted if all we want is to show staled networks.
parent ab1825a2
......@@ -1660,16 +1660,18 @@ def cleanup_networks(action_timeout, query_interval, delete_stale=False):
return
fail_tmout = time.time() + action_timeout
while True:
servers = c.list_servers()
staleServers = [s for s in servers if s["name"].startswith(SNF_TEST_PREFIX)]
if len(staleServers) == 0:
break
elif time.time() > fail_tmout:
log.error("Stale servers not deleted from previous run")
sys.exit()
else:
time.sleep(query_interval)
# Wait for deleting servers only if `delete_stale' is True
if delete_stale:
while True:
servers = c.list_servers()
staleServers = [s for s in servers if s["name"].startswith(SNF_TEST_PREFIX)]
if len(staleServers) == 0:
break
elif time.time() > fail_tmout:
log.error("Stale servers not deleted from previous run")
sys.exit()
else:
time.sleep(query_interval)
print >> sys.stderr, yellow + "Found these stale networks from previous runs:" + normal
print " " + \
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment