Fix extra loops in requesting SSH accessability while nodes are bootstrapping
Change-Id: I64166e128ac79af3c449988ec45ca4dd76ee6f9f
diff --git a/tcp_tests/managers/envmanager_heat.py b/tcp_tests/managers/envmanager_heat.py
index 5422b1f..95c1cb2 100644
--- a/tcp_tests/managers/envmanager_heat.py
+++ b/tcp_tests/managers/envmanager_heat.py
@@ -452,8 +452,8 @@
'[ -f /var/log/mcp/.bootstrap_done ]')
check_cloudinit_failed = 'cat /is_cloud_init_failed'
passed = {}
- for node in self._get_nodes_by_roles(roles=underlay_node_roles):
-
+ nodes_by_roles = self._get_nodes_by_roles(roles=underlay_node_roles)
+ for node in nodes_by_roles:
try:
node_ip = self.node_ip(node)
except exceptions.EnvironmentNodeAccessError:
@@ -500,16 +500,23 @@
def _ssh_wait(host,
port,
username=settings.SSH_NODE_CREDENTIALS['login'],
- password=settings.SSH_NODE_CREDENTIALS['password'],
- timeout=0):
+ password=settings.SSH_NODE_CREDENTIALS['password']):
+ """
+ Collects hosts have passed the SSH / cloud-init checks.
+ And returns True if host has passed this check
- if host in passed and passed[host] >= 2:
+ :param host: str, IP address to connect via SSH
+ :param port: int, port to connect via SSH
+ :param username: str, name of SSH user
+ :param password: str, password for SSH user
+ :return: True if host has passed the probe test
+ """
+ if host in passed and passed[host] >= 1:
# host already passed the check
return True
- for node in self._get_nodes_by_roles(
- roles=underlay_node_roles):
- ip = node_ip
+ for _node in nodes_by_roles:
+ ip = self.node_ip(_node)
if ip not in passed:
passed[ip] = 0
if _ssh_check(ip, port):