Fix async keyword for Python 3.7
In Python 3.7, async becomes a keyword, and therefore, scciclient was failing. This patch renames async into do_async. Change-Id: I030cd6d9f3e35a9850771b2c55943e043818309a
This commit is contained in:
parent
a38fd836e8
commit
d8f1f1c73b
|
@ -242,7 +242,7 @@ def get_share_type(share_type):
|
|||
|
||||
|
||||
def scci_cmd(host, userid, password, cmd, port=443, auth_method='basic',
|
||||
client_timeout=60, async=True, **kwargs):
|
||||
client_timeout=60, do_async=True, **kwargs):
|
||||
"""execute SCCI command
|
||||
|
||||
This function calls SCCI server modules
|
||||
|
@ -253,7 +253,7 @@ def scci_cmd(host, userid, password, cmd, port=443, auth_method='basic',
|
|||
:param port: port number of iRMC
|
||||
:param auth_method: irmc_username
|
||||
:param client_timeout: timeout for SCCI operations
|
||||
:param async: async call if True, sync call otherwise
|
||||
:param do_async: async call if True, sync call otherwise
|
||||
:returns: requests.Response from SCCI server
|
||||
:raises: SCCIInvalidInputError if port and/or auth_method params
|
||||
are invalid
|
||||
|
@ -282,12 +282,12 @@ def scci_cmd(host, userid, password, cmd, port=443, auth_method='basic',
|
|||
timeout=client_timeout,
|
||||
allow_redirects=False,
|
||||
auth=auth_obj)
|
||||
if not async:
|
||||
if not do_async:
|
||||
time.sleep(5)
|
||||
if DEBUG:
|
||||
print(cmd)
|
||||
print(r.text)
|
||||
print("async = %s" % async)
|
||||
print("do_async = %s" % do_async)
|
||||
if r.status_code not in (200, 201):
|
||||
raise SCCIClientError(
|
||||
('HTTP PROTOCOL ERROR, STATUS CODE = %s' %
|
||||
|
|
|
@ -570,7 +570,7 @@ class SCCITestCase(testtools.TestCase):
|
|||
auth_method=self.irmc_auth_method,
|
||||
client_timeout=self.irmc_client_timeout)
|
||||
|
||||
r = client(cmd, async=False)
|
||||
r = client(cmd, do_async=False)
|
||||
self.assertEqual(r.status_code, 200)
|
||||
sleep_mock.assert_called_once_with(5)
|
||||
|
||||
|
@ -598,7 +598,7 @@ class SCCITestCase(testtools.TestCase):
|
|||
port=self.irmc_port,
|
||||
auth_method=self.irmc_auth_method,
|
||||
client_timeout=self.irmc_client_timeout)
|
||||
r = client(cmd, async=False)
|
||||
r = client(cmd, do_async=False)
|
||||
self.assertEqual(r.status_code, 200)
|
||||
sleep_mock.assert_called_once_with(5)
|
||||
|
||||
|
|
Loading…
Reference in New Issue