Use node UUID for bridge_mapping agent check

When we check for bridge mapping. If the user
has provided the Name of the node, rather than
the UUID. Then we will fail to lookup the agent.

This change ensures that we lookup the agent using
the nodes UUID rather than the name, regardless of
what the user has input in the provide command.

Change-Id: Iceea8fbb3053aa0af7ba46bec43dcedb3e8801b8
This commit is contained in:
bshephar 2022-03-23 22:21:33 +00:00 committed by Brendan Shephard
parent 1e294cf7a7
commit 65f36df818
1 changed files with 7 additions and 1 deletions

View File

@ -108,6 +108,12 @@ class TripleoProvide(TripleoBaremetal):
def _wait_for_bridge_mapping(self, node: str):
client = self.conn.network
try:
node_id = self.conn.baremetal.find_node(
node, ignore_missing=False).id
except exceptions.ResourceNotFound:
self.log.error('Node with UUID: {} not found'.format(node))
timeout_msg = (f'Timeout waiting for node {node} to have '
'bridge_mappings set in the ironic-neutron-agent '
'entry')
@ -117,7 +123,7 @@ class TripleoProvide(TripleoBaremetal):
for count in iterate_timeout(timeout, timeout_msg):
agents = list(
client.agents(host=node, binary='ironic-neutron-agent'))
client.agents(host=node_id, binary='ironic-neutron-agent'))
if agents:
if agents[0].configuration.get('bridge_mappings'):