Honors return value from BIOS interface cleansteps

When a BIOS interface clean step is executed the return value is ignored.
If it is asynchronous, the return value which is CLEANWAIT state is ignored
and the cleanstep is marked as complete immediately. The current change
honors the return value and moves the node to CLEANWAIT state accordingly.

Change-Id: I3a3915116286326316ee9a55333c046f729c1a08
Story: #2003750
Task: #26438
This commit is contained in:
vmud213 2018-09-17 17:48:35 +05:30
parent 36e87dc5b4
commit 85b0d3e141
3 changed files with 14 additions and 5 deletions

View File

@ -1039,8 +1039,9 @@ class BIOSInterface(BaseInterface):
def wrapper(func): def wrapper(func):
@six.wraps(func) @six.wraps(func)
def wrapped(task, *args, **kwargs): def wrapped(task, *args, **kwargs):
func(task, *args, **kwargs) result = func(task, *args, **kwargs)
instance.cache_bios_settings(task) instance.cache_bios_settings(task)
return result
return wrapped return wrapped
for n, method in inspect.getmembers(instance, inspect.ismethod): for n, method in inspect.getmembers(instance, inspect.ismethod):

View File

@ -550,10 +550,10 @@ class MyBIOSInterface(driver_base.BIOSInterface):
pass pass
def apply_configuration(self, task, settings): def apply_configuration(self, task, settings):
pass return "return_value_apply_configuration"
def factory_reset(self, task): def factory_reset(self, task):
pass return "return_value_factory_reset"
def cache_bios_settings(self, task): def cache_bios_settings(self, task):
pass pass
@ -566,16 +566,18 @@ class TestBIOSInterface(base.TestCase):
bios = MyBIOSInterface() bios = MyBIOSInterface()
task_mock = mock.MagicMock() 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) 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) @mock.patch.object(MyBIOSInterface, 'cache_bios_settings', autospec=True)
def test_factory_reset_wrapper(self, cache_bios_settings_mock): def test_factory_reset_wrapper(self, cache_bios_settings_mock):
bios = MyBIOSInterface() bios = MyBIOSInterface()
task_mock = mock.MagicMock() 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) cache_bios_settings_mock.assert_called_once_with(bios, task_mock)
self.assertEqual(actual, "return_value_factory_reset")
class TestBootInterface(base.TestCase): class TestBootInterface(base.TestCase):

View File

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