Browse Source

Fix port id vs uuid in ValidateInterfacesHook

follow-up to Icd3de82877c6a53d32b4c9fd3e500d3cd9d7fb17

Use id attribute instead of uuid. This caused an exception when an unexpected
port was being deleted.

Story: 2008698
Task: 42007
Change-Id: Ib4978f5e3e4f1b64faa1bfae3cdcf46199bb2f21
(cherry picked from commit 22853a74b5f30c0047a1ffab039f983e2563a335)
changes/74/780474/1
Francois Rigault 1 month ago
committed by Dmitry Tantsur
parent
commit
6a668c65aa
2 changed files with 2 additions and 2 deletions
  1. +1
    -1
      ironic_inspector/plugins/standard.py
  2. +1
    -1
      ironic_inspector/test/unit/test_plugins_standard.py

+ 1
- 1
ironic_inspector/plugins/standard.py View File

@ -294,7 +294,7 @@ class ValidateInterfacesHook(base.ProcessingHook):
if port.address not in expected_macs:
LOG.info("Deleting port %(port)s as its MAC %(mac)s is "
"not in expected MAC list %(expected)s",
{'port': port.uuid,
{'port': port.id,
'mac': port.address,
'expected': list(sorted(expected_macs))},
node_info=node_info, data=introspection_data)


+ 1
- 1
ironic_inspector/test/unit/test_plugins_standard.py View File

@ -256,7 +256,7 @@ class TestValidateInterfacesHookBeforeUpdateDeletion(test_base.NodeTest):
self.hook = std_plugins.ValidateInterfacesHook()
self.interfaces_to_create = sorted(self.valid_interfaces.values(),
key=lambda i: i['mac'])
self.existing_ports = [mock.Mock(spec=['address', 'uuid'],
self.existing_ports = [mock.Mock(spec=['address', 'id'],
address=a)
for a in (self.macs[1],
'44:44:44:44:44:44')]


Loading…
Cancel
Save