summaryrefslogtreecommitdiff
path: root/ironic/tests/unit/drivers
diff options
context:
space:
mode:
authorJacob Anders <janders@redhat.com>2023-04-17 14:39:50 +1000
committerDmitry Tantsur <dtantsur@protonmail.com>2023-05-09 10:55:17 +0000
commitf576b4d60fa9230cc7f6b77c5c65d44abfc9f047 (patch)
tree2a07b4e2e67802ab0d4b831b5ec3db735899a3e1 /ironic/tests/unit/drivers
parent7ea86a8669ddcba70b9a3ca05f54ebd341446097 (diff)
downloadironic-f576b4d60fa9230cc7f6b77c5c65d44abfc9f047.tar.gz
Handle MissingAttributeError when using OOB inspections to fetch MACsbugfix/21.0
Currently, if an attempt is made to fetch MAC address information using OOB inspection on a Redfish-managed node and EthernetInterfaces attribute is missing on the node, inspection fails due to a MissingAttributeError exception being raised by sushy. This change adds catching and handling this exception. Change-Id: I6f16da05e19c7efc966128fdf79f13546f51b5a6 (cherry picked from commit f10958a542dd58ff301c386ce0981ec218e9eef6)
Diffstat (limited to 'ironic/tests/unit/drivers')
-rw-r--r--ironic/tests/unit/drivers/modules/redfish/test_management.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/ironic/tests/unit/drivers/modules/redfish/test_management.py b/ironic/tests/unit/drivers/modules/redfish/test_management.py
index f8c82949a..1d752d909 100644
--- a/ironic/tests/unit/drivers/modules/redfish/test_management.py
+++ b/ironic/tests/unit/drivers/modules/redfish/test_management.py
@@ -1598,3 +1598,13 @@ class RedfishManagementTestCase(db_base.DbTestCase):
shared=True) as task:
self.assertEqual([],
task.driver.management.get_mac_addresses(task))
+
+ @mock.patch.object(redfish_utils, 'get_enabled_macs', autospec=True)
+ @mock.patch.object(redfish_utils, 'get_system', autospec=True)
+ def test_get_mac_addresses_missing_attr(self, mock_get_system,
+ mock_get_enabled_macs):
+ redfish_utils.get_enabled_macs.side_effect = (sushy.exceptions.
+ MissingAttributeError)
+ with task_manager.acquire(self.context, self.node.uuid,
+ shared=True) as task:
+ self.assertIsNone(task.driver.management.get_mac_addresses(task))