Handle a different related properties for missing TransferProtocolType
Closes-Bug: 2048430 Change-Id: I413830261c8e1538c9bc4745c0a72176771cc631
This commit is contained in:
parent
ac0c3e10c6
commit
f4b84abadf
@ -0,0 +1,6 @@
|
||||
---
|
||||
fixes:
|
||||
- |
|
||||
Correctly handles error code ``Base.1.12.ActionParameterMissing`` when dealing with
|
||||
hardware that requires ``TransferProtocolType`` for virtual media
|
||||
operations and has different message in RelatedProperties response.
|
@ -118,7 +118,8 @@ class VirtualMedia(base.ResourceBase):
|
||||
return (
|
||||
(error.code.endswith(".ActionParameterMissing")
|
||||
or error.code.endswith(".PropertyMissing"))
|
||||
and "#/TransferProtocolType" in error.related_properties
|
||||
and (("#/TransferProtocolType" in error.related_properties)
|
||||
or ("/TransferProtocolType" in error.related_properties))
|
||||
)
|
||||
|
||||
def is_transfer_method_required(self, error=None):
|
||||
|
@ -0,0 +1,22 @@
|
||||
{
|
||||
"error": {
|
||||
"@Message.ExtendedInfo": [
|
||||
{
|
||||
"@odata.type": "#Message.v1_0_8.Message",
|
||||
"Message": "The action /redfish/v1/Managers/Self/VirtualMedia/CD1/Actions/VirtualMedia.InsertMedia requires the parameter TransferProtocolType to be present in the request body.",
|
||||
"MessageArgs": [
|
||||
"/redfish/v1/Managers/Self/VirtualMedia/CD1/Actions/VirtualMedia.InsertMedia",
|
||||
"TransferProtocolType"
|
||||
],
|
||||
"MessageId": "Base.1.12.ActionParameterMissing",
|
||||
"RelatedProperties": [
|
||||
"/TransferProtocolType"
|
||||
],
|
||||
"Resolution": "Supply the action with the required parameter in the request body when the request is resubmitted.",
|
||||
"Severity": "Critical"
|
||||
}
|
||||
],
|
||||
"code": "Base.1.12.ActionParameterMissing",
|
||||
"message": "The action /redfish/v1/Managers/Self/VirtualMedia/CD1/Actions/VirtualMedia.InsertMedia requires the parameter TransferProtocolType to be present in the request body."
|
||||
}
|
||||
}
|
@ -207,6 +207,16 @@ class VirtualMediaTestCase(base.TestCase):
|
||||
retval = self.sys_virtual_media.is_transfer_protocol_required(error)
|
||||
self.assertTrue(retval)
|
||||
|
||||
def test_is_transfer_protocol_required_alt3(self):
|
||||
with open('sushy/tests/unit/json_samples/'
|
||||
'transfer_proto_required_error3.json') as f:
|
||||
response_obj = json.load(f)
|
||||
response = mock.Mock(spec=['json', 'status_code'])
|
||||
response.json.return_value = response_obj
|
||||
error = exceptions.HTTPError('GET', 'VirtualMedia', response)
|
||||
retval = self.sys_virtual_media.is_transfer_protocol_required(error)
|
||||
self.assertTrue(retval)
|
||||
|
||||
def test_is_transfer_method_required(self):
|
||||
with open('sushy/tests/unit/json_samples/'
|
||||
'transfer_method_required_error.json') as f:
|
||||
|
Loading…
Reference in New Issue
Block a user