Merge "Remove etag from Bios"

This commit is contained in:
Zuul 2018-07-02 09:27:59 +00:00 committed by Gerrit Code Review
commit e5400176cd
4 changed files with 6 additions and 25 deletions

View File

@ -78,7 +78,7 @@ class SettingsField(base.CompositeField):
"""Represents the results of the last time the values of the Settings
resource were applied to the server"""
def commit(self, connector, value, etag=None):
def commit(self, connector, value):
"""Commits new settings values
The new values will be applied when the system or a service
@ -92,9 +92,7 @@ class SettingsField(base.CompositeField):
the new values will not be committed
"""
connector.patch(self.resource_uri,
data=value,
headers={'If-Match': etag} if etag else None)
connector.patch(self.resource_uri, data=value)
@property
def resource_uri(self):

View File

@ -56,8 +56,6 @@ class Bios(base.ResourceBase):
_actions = ActionsField('Actions')
_etag = base.Field('@odata.etag')
_pending_settings_resource = None
@property
@ -98,8 +96,7 @@ class Bios(base.ResourceBase):
:param value: Key-value pairs for attribute name and value
"""
self._settings.commit(self._conn,
{'Attributes': value},
self._etag)
{'Attributes': value})
if self._pending_settings_resource:
self._pending_settings_resource.invalidate()

View File

@ -48,7 +48,6 @@ class BiosTestCase(base.TestCase):
self.assertEqual('BIOS Configuration Current Settings',
self.sys_bios.name)
self.assertIsNone(self.sys_bios.description)
self.assertEqual('123', self.sys_bios._etag)
self.assertEqual('BiosAttributeRegistryP89.v1_0_0',
self.sys_bios._attribute_registry)
self.assertEqual('', self.sys_bios.attributes['AdminPhone'])
@ -65,8 +64,7 @@ class BiosTestCase(base.TestCase):
self.sys_bios.set_attribute('ProcTurboMode', 'Disabled')
self.sys_bios._conn.patch.assert_called_once_with(
'/redfish/v1/Systems/437XR1138R2/BIOS/Settings',
data={'Attributes': {'ProcTurboMode': 'Disabled'}},
headers={'If-Match': '123'})
data={'Attributes': {'ProcTurboMode': 'Disabled'}})
def test_set_attribute_on_refresh(self):
# make it to instantiate pending attributes
@ -83,8 +81,7 @@ class BiosTestCase(base.TestCase):
self.sys_bios._conn.patch.assert_called_once_with(
'/redfish/v1/Systems/437XR1138R2/BIOS/Settings',
data={'Attributes': {'ProcTurboMode': 'Disabled',
'UsbControl': 'UsbDisabled'}},
headers={'If-Match': '123'})
'UsbControl': 'UsbDisabled'}})
def test_set_attributes_on_refresh(self):
# make it to instantiate pending attributes

View File

@ -60,15 +60,4 @@ class SettingsFieldTestCase(base.TestCase):
instance.commit(conn, {'Attributes': {'key': 'value'}})
conn.patch.assert_called_once_with(
'/redfish/v1/Systems/437XR1138R2/BIOS/Settings',
data={'Attributes': {'key': 'value'}}, headers=None)
def test_commit_with_etag(self):
conn = mock.Mock()
instance = self.settings._load(self.json, conn)
instance.commit(conn,
{'Attributes': {'key': 'value'}},
'123')
conn.patch.assert_called_once_with(
'/redfish/v1/Systems/437XR1138R2/BIOS/Settings',
data={'Attributes': {'key': 'value'}},
headers={'If-Match': '123'})
data={'Attributes': {'key': 'value'}})