mirror of
https://github.com/GNS3/gns3-server
synced 2024-12-26 08:48:11 +00:00
Fix TypeError: http_query() got an unexpected keyword argument 'timeout'
Fix #947
This commit is contained in:
parent
bc0e4c1174
commit
a62b791c68
@ -93,7 +93,7 @@ class Docker(BaseManager):
|
|||||||
return body
|
return body
|
||||||
|
|
||||||
@asyncio.coroutine
|
@asyncio.coroutine
|
||||||
def http_query(self, method, path, data={}, params={}):
|
def http_query(self, method, path, data={}, params={}, timeout=300):
|
||||||
"""
|
"""
|
||||||
Make a query to the docker daemon
|
Make a query to the docker daemon
|
||||||
|
|
||||||
@ -101,6 +101,7 @@ class Docker(BaseManager):
|
|||||||
:param path: Endpoint in API
|
:param path: Endpoint in API
|
||||||
:param data: Dictionnary with the body. Will be transformed to a JSON
|
:param data: Dictionnary with the body. Will be transformed to a JSON
|
||||||
:param params: Parameters added as a query arg
|
:param params: Parameters added as a query arg
|
||||||
|
:param timeout: Timeout
|
||||||
:returns: HTTP response
|
:returns: HTTP response
|
||||||
"""
|
"""
|
||||||
data = json.dumps(data)
|
data = json.dumps(data)
|
||||||
@ -113,6 +114,7 @@ class Docker(BaseManager):
|
|||||||
params=params,
|
params=params,
|
||||||
data=data,
|
data=data,
|
||||||
headers={"content-type": "application/json", },
|
headers={"content-type": "application/json", },
|
||||||
|
timeout=timeout
|
||||||
)
|
)
|
||||||
except (aiohttp.ClientResponseError, aiohttp.ClientOSError) as e:
|
except (aiohttp.ClientResponseError, aiohttp.ClientOSError) as e:
|
||||||
raise DockerError("Docker has returned an error: {}".format(str(e)))
|
raise DockerError("Docker has returned an error: {}".format(str(e)))
|
||||||
|
@ -51,7 +51,8 @@ def test_query_success(loop, vm):
|
|||||||
connector=vm._connector,
|
connector=vm._connector,
|
||||||
data='{"a": true}',
|
data='{"a": true}',
|
||||||
headers={'content-type': 'application/json'},
|
headers={'content-type': 'application/json'},
|
||||||
params={'b': 1})
|
params={'b': 1},
|
||||||
|
timeout=300)
|
||||||
|
|
||||||
assert data == {"c": False}
|
assert data == {"c": False}
|
||||||
|
|
||||||
@ -74,7 +75,8 @@ def test_query_error(loop, vm):
|
|||||||
connector=vm._connector,
|
connector=vm._connector,
|
||||||
data='{"a": true}',
|
data='{"a": true}',
|
||||||
headers={'content-type': 'application/json'},
|
headers={'content-type': 'application/json'},
|
||||||
params={'b': 1})
|
params={'b': 1},
|
||||||
|
timeout=300)
|
||||||
|
|
||||||
|
|
||||||
def test_query_error_json(loop, vm):
|
def test_query_error_json(loop, vm):
|
||||||
@ -95,7 +97,8 @@ def test_query_error_json(loop, vm):
|
|||||||
connector=vm._connector,
|
connector=vm._connector,
|
||||||
data='{"a": true}',
|
data='{"a": true}',
|
||||||
headers={'content-type': 'application/json'},
|
headers={'content-type': 'application/json'},
|
||||||
params={'b': 1})
|
params={'b': 1},
|
||||||
|
timeout=300)
|
||||||
|
|
||||||
|
|
||||||
def test_list_images(loop):
|
def test_list_images(loop):
|
||||||
|
Loading…
Reference in New Issue
Block a user