From 0196cd316236ca48f41ace48c662f4735b574b7b Mon Sep 17 00:00:00 2001 From: Shivanand Tendulker Date: Fri, 14 Feb 2020 08:16:51 -0500 Subject: [PATCH] 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 --- proliantutils/redfish/connector.py | 10 +++++++--- proliantutils/tests/redfish/test_connector.py | 4 +++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/proliantutils/redfish/connector.py b/proliantutils/redfish/connector.py index dc8f05c2..aa028fc2 100644 --- a/proliantutils/redfish/connector.py +++ b/proliantutils/redfish/connector.py @@ -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: diff --git a/proliantutils/tests/redfish/test_connector.py b/proliantutils/tests/redfish/test_connector.py index c0a79a1a..7d13d0f6 100644 --- a/proliantutils/tests/redfish/test_connector.py +++ b/proliantutils/tests/redfish/test_connector.py @@ -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)