diff --git a/ironic/drivers/base.py b/ironic/drivers/base.py index 1c6a376099..a712cc43f4 100644 --- a/ironic/drivers/base.py +++ b/ironic/drivers/base.py @@ -1039,8 +1039,9 @@ class BIOSInterface(BaseInterface): def wrapper(func): @six.wraps(func) def wrapped(task, *args, **kwargs): - func(task, *args, **kwargs) + result = func(task, *args, **kwargs) instance.cache_bios_settings(task) + return result return wrapped for n, method in inspect.getmembers(instance, inspect.ismethod): diff --git a/ironic/tests/unit/drivers/test_base.py b/ironic/tests/unit/drivers/test_base.py index d3f7367655..1233810254 100644 --- a/ironic/tests/unit/drivers/test_base.py +++ b/ironic/tests/unit/drivers/test_base.py @@ -550,10 +550,10 @@ class MyBIOSInterface(driver_base.BIOSInterface): pass def apply_configuration(self, task, settings): - pass + return "return_value_apply_configuration" def factory_reset(self, task): - pass + return "return_value_factory_reset" def cache_bios_settings(self, task): pass @@ -566,16 +566,18 @@ class TestBIOSInterface(base.TestCase): bios = MyBIOSInterface() task_mock = mock.MagicMock() - bios.apply_configuration(task_mock, "") + actual = bios.apply_configuration(task_mock, "") cache_bios_settings_mock.assert_called_once_with(bios, task_mock) + self.assertEqual(actual, "return_value_apply_configuration") @mock.patch.object(MyBIOSInterface, 'cache_bios_settings', autospec=True) def test_factory_reset_wrapper(self, cache_bios_settings_mock): bios = MyBIOSInterface() task_mock = mock.MagicMock() - bios.factory_reset(task_mock) + actual = bios.factory_reset(task_mock) cache_bios_settings_mock.assert_called_once_with(bios, task_mock) + self.assertEqual(actual, "return_value_factory_reset") class TestBootInterface(base.TestCase): diff --git a/releasenotes/notes/async_bios_clean_step-7348efff3f6d02c1.yaml b/releasenotes/notes/async_bios_clean_step-7348efff3f6d02c1.yaml new file mode 100644 index 0000000000..bbe4850012 --- /dev/null +++ b/releasenotes/notes/async_bios_clean_step-7348efff3f6d02c1.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - | + Fixes the bug in executing asynchronous BIOS interface clean step by + honoring the state returned by the BIOS interface clean step which + was ignored earlier.