From 06390e372384d15448c5ed10f77d93faa494816a Mon Sep 17 00:00:00 2001 From: Dmitry Tantsur Date: Tue, 7 Jul 2020 14:40:49 +0200 Subject: [PATCH] Use node.id instead of node.uuid in record_node This function does not have a compatibility shim that adds 'uuid'. Change-Id: I131c8189b25ee2de66f08c742a21052ef1b266aa --- ironic_inspector/node_cache.py | 5 ++--- ironic_inspector/test/unit/test_node_cache.py | 1 + releasenotes/notes/node-id-920629472f01c83a.yaml | 5 +++++ 3 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 releasenotes/notes/node-id-920629472f01c83a.yaml diff --git a/ironic_inspector/node_cache.py b/ironic_inspector/node_cache.py index 0e9d748c9..3c75509b0 100644 --- a/ironic_inspector/node_cache.py +++ b/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) diff --git a/ironic_inspector/test/unit/test_node_cache.py b/ironic_inspector/test/unit/test_node_cache.py index 736090ada..6118afe73 100644 --- a/ironic_inspector/test/unit/test_node_cache.py +++ b/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): diff --git a/releasenotes/notes/node-id-920629472f01c83a.yaml b/releasenotes/notes/node-id-920629472f01c83a.yaml new file mode 100644 index 000000000..bcf5008bb --- /dev/null +++ b/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.