Add TransferProtocolType for any general error that mentions it
Story: 2010621 Task: 47554 Change-Id: I0d1a200c3fe3d4806d660553ee2f59b8d217f06c
This commit is contained in:
parent
a59cf6c698
commit
2506b87d87
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
fixes:
|
||||
- |
|
||||
Add TransferProtocolType for any general error that mentions it
|
|
@ -111,6 +111,10 @@ class VirtualMedia(base.ResourceBase):
|
|||
|
||||
Try to determine if it happened due to missing TransferProtocolType.
|
||||
"""
|
||||
if (error.code.endswith('GeneralError')
|
||||
and 'TransferProtocolType' in error.detail):
|
||||
return True
|
||||
|
||||
return (
|
||||
(error.code.endswith(".ActionParameterMissing")
|
||||
or error.code.endswith(".PropertyMissing"))
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"error": {
|
||||
"code": "Base.1.4.0.GeneralError",
|
||||
"message": "See ExtendedInfo for more information.",
|
||||
"@Message.ExtendedInfo": [
|
||||
{
|
||||
"@odata.type": "Message.v1_0_6.Message",
|
||||
"MessageId": "Base.1.4.0.GeneralError",
|
||||
"Message": "'TransferProtocolType' property which is mandatory to complete the action is missing in the request body.",
|
||||
"MessageArgs": [],
|
||||
"Severity": "Critical"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
@ -186,7 +186,7 @@ class VirtualMediaTestCase(base.TestCase):
|
|||
retval = self.sys_virtual_media.is_transfer_protocol_required(error)
|
||||
self.assertTrue(retval)
|
||||
|
||||
def test_is_transfer_protocol_required_alt_code(self):
|
||||
def test_is_transfer_protocol_required_alt(self):
|
||||
with open('sushy/tests/unit/json_samples/'
|
||||
'transfer_proto_required_error.json') as f:
|
||||
response_obj = json.load(f)
|
||||
|
@ -197,6 +197,16 @@ class VirtualMediaTestCase(base.TestCase):
|
|||
retval = self.sys_virtual_media.is_transfer_protocol_required(error)
|
||||
self.assertTrue(retval)
|
||||
|
||||
def test_is_transfer_protocol_required_alt2(self):
|
||||
with open('sushy/tests/unit/json_samples/'
|
||||
'transfer_proto_required_error2.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_eject_media_none(self):
|
||||
self.sys_virtual_media._actions.eject_media = None
|
||||
self.assertRaisesRegex(
|
||||
|
|
Loading…
Reference in New Issue