Browse Source

Use node.id instead of node.uuid in record_node

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

Change-Id: I131c8189b25ee2de66f08c742a21052ef1b266aa
changes/30/739730/1
Dmitry Tantsur 2 years ago
parent
commit
06390e3723
  1. 5
      ironic_inspector/node_cache.py
  2. 1
      ironic_inspector/test/unit/test_node_cache.py
  3. 5
      releasenotes/notes/node-id-920629472f01c83a.yaml

5
ironic_inspector/node_cache.py

@ -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)

1
ironic_inspector/test/unit/test_node_cache.py

@ -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):

5
releasenotes/notes/node-id-920629472f01c83a.yaml

@ -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.
Loading…
Cancel
Save