Use node.id instead of node.uuid in record_node

This function does not have a compatibility shim that adds 'uuid'.

Change-Id: I131c8189b25ee2de66f08c742a21052ef1b266aa
This commit is contained in:
Dmitry Tantsur 2020-07-07 14:40:49 +02:00
parent 63e1d749fb
commit 06390e3723
3 changed files with 8 additions and 3 deletions

View File

@ -958,10 +958,9 @@ def record_node(ironic=None, bmc_addresses=None, macs=None):
if node.provision_state not in ir_utils.VALID_ACTIVE_STATES:
raise utils.Error(_("Node %(node)s is not active, its provision "
"state is %(state)s") %
{'node': node.uuid,
'state': node.provision_state})
{'node': node.id, 'state': node.provision_state})
return add_node(node.uuid, istate.States.waiting,
return add_node(node.id, istate.States.waiting,
manage_boot=False, mac=macs, bmc_address=bmc_addresses)

View File

@ -1337,6 +1337,7 @@ class TestRecordNode(test_base.NodeTest):
super(TestRecordNode, self).setUp()
self.node.provision_state = 'active'
self.ironic = mock.Mock(spec=['get_node'])
del self.node.uuid # no compatibility shim here
self.ironic.get_node.return_value = self.node
def test_no_lookup_data(self, mock_lookup):

View File

@ -0,0 +1,5 @@
---
fixes:
- |
Fixes ``AttributeError: 'Node' object has no attribute 'uuid'`` when
trying to introspect an active node that is not currently in the cache.