The _op method has changed in sushy 3.10

The sushy method _op() in connector.py accepts new set of arguments.
Proliantutils needs to accept these arguments in its overridden
method.

Change-Id: If66e23209cfcae7c418d1e0dec34add5ed65dc6c
Closes-Bug: #1863236
This commit is contained in:
Shivanand Tendulker 2020-02-14 08:16:51 -05:00
parent 086b3485c2
commit 0196cd3162
2 changed files with 10 additions and 4 deletions

View File

@ -35,7 +35,8 @@ class HPEConnector(connector.Connector):
lambda e: isinstance(e, exceptions.ConnectionError)),
stop_max_attempt_number=MAX_RETRY_ATTEMPTS,
wait_fixed=MAX_TIME_BEFORE_RETRY)
def _op(self, method, path='', data=None, headers=None):
def _op(self, method, path='', data=None, headers=None,
blocking=False, timeout=60):
"""Overrides the base method to support retrying the operation.
:param method: The HTTP method to be used, e.g: GET, POST,
@ -43,10 +44,13 @@ class HPEConnector(connector.Connector):
:param path: The sub-URI path to the resource.
:param data: Optional JSON data.
:param headers: Optional dictionary of headers.
:param blocking: Whether to block for asynchronous operations.
:param timeout: Max time in seconds to wait for blocking async call.
:returns: The response from the connector.Connector's _op method.
"""
resp = super(HPEConnector, self)._op(method, path, data,
headers, allow_redirects=False)
resp = super(HPEConnector, self)._op(method, path, data, headers,
blocking, timeout,
allow_redirects=False)
# With IPv6, Gen10 server gives redirection response with new path with
# a prefix of '/' so this check is required
if resp.status_code == 308:

View File

@ -38,6 +38,7 @@ class HPEConnectorTestCase(testtools.TestCase):
hpe_conn._op('GET', path='fake/path', data=None, headers=headers)
conn_mock.assert_called_once_with(hpe_conn, 'GET', path='fake/path',
data=None, headers=headers,
blocking=False, timeout=60,
allow_redirects=False)
self.assertEqual(1, conn_mock.call_count)
@ -88,7 +89,8 @@ class HPEConnectorTestCase(testtools.TestCase):
res = hpe_conn._op('GET', path='fake/path',
data=None, headers=headers)
calls = [mock.call(hpe_conn, 'GET', path='fake/path', data=None,
headers=headers, allow_redirects=False),
headers=headers, blocking=False, timeout=60,
allow_redirects=False),
mock.call(hpe_conn, 'GET', path='/new/path', data=None,
headers=headers)]
conn_mock.assert_has_calls(calls)