Merge "Check node names using startswith instead of in"

This commit is contained in:
Zuul 2024-08-11 15:56:45 +00:00 committed by Gerrit Code Review
commit e788e7a845

View File

@ -230,9 +230,9 @@ class BaseTempestWhiteboxTestCase(base.BaseTempestTestCase):
def append_node_data(node, is_crc):
# Here we mean ansible controller node used by the ci-framework
# This controller is not a part of OSP and should be skipped
if 'controller' in node:
if node.startswith('controller'):
return
if 'ocp' in node and not is_crc:
if node.startswith('ocp') and not is_crc:
# a specific ssh key is used for accessing ocp nodes
key = 'ansible_ssh_private_key_file' # meaning dict key here
# save path of ocp nodes key (if not yet), we'll need it later
@ -247,7 +247,8 @@ class BaseTempestWhiteboxTestCase(base.BaseTempestTestCase):
node_key = 'id_cifw_key'
node_ip = hosts_data[node]['ansible_host']
# Here we mean a node with running OSP control plane services
is_controller = (('ocp' in node) or ('crc' in node))
is_controller = (node.startswith('ocp') or
node.startswith('crc'))
node_data = {
'ip': node_ip,
'user': hosts_data[node]['ansible_user'],
@ -261,7 +262,8 @@ class BaseTempestWhiteboxTestCase(base.BaseTempestTestCase):
'cat ' + WB_CONF.proxy_host_inventory_path))
is_crc = False
ocps = inventory_data['all']['children']['ocps']
if 'hosts' in ocps and 'crc' in ocps['hosts'].keys():
if 'hosts' in ocps and any(ocp_key.startswith('crc')
for ocp_key in ocps['hosts'].keys()):
is_crc = True
else:
# create ocp_node_yaml_list