From a62b791c68cba09b21717cc42efc97b0f6c707e7 Mon Sep 17 00:00:00 2001 From: Julien Duponchelle Date: Mon, 20 Mar 2017 17:06:00 +0100 Subject: [PATCH] Fix TypeError: http_query() got an unexpected keyword argument 'timeout' Fix #947 --- gns3server/compute/docker/__init__.py | 4 +++- tests/compute/docker/test_docker.py | 9 ++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/gns3server/compute/docker/__init__.py b/gns3server/compute/docker/__init__.py index 1ff3430d0..5b41bd2c5 100644 --- a/gns3server/compute/docker/__init__.py +++ b/gns3server/compute/docker/__init__.py @@ -93,7 +93,7 @@ class Docker(BaseManager): return body @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 @@ -101,6 +101,7 @@ class Docker(BaseManager): :param path: Endpoint in API :param data: Dictionnary with the body. Will be transformed to a JSON :param params: Parameters added as a query arg + :param timeout: Timeout :returns: HTTP response """ data = json.dumps(data) @@ -113,6 +114,7 @@ class Docker(BaseManager): params=params, data=data, headers={"content-type": "application/json", }, + timeout=timeout ) except (aiohttp.ClientResponseError, aiohttp.ClientOSError) as e: raise DockerError("Docker has returned an error: {}".format(str(e))) diff --git a/tests/compute/docker/test_docker.py b/tests/compute/docker/test_docker.py index 79523543a..c71ef3fbc 100644 --- a/tests/compute/docker/test_docker.py +++ b/tests/compute/docker/test_docker.py @@ -51,7 +51,8 @@ def test_query_success(loop, vm): connector=vm._connector, data='{"a": true}', headers={'content-type': 'application/json'}, - params={'b': 1}) + params={'b': 1}, + timeout=300) assert data == {"c": False} @@ -74,7 +75,8 @@ def test_query_error(loop, vm): connector=vm._connector, data='{"a": true}', headers={'content-type': 'application/json'}, - params={'b': 1}) + params={'b': 1}, + timeout=300) def test_query_error_json(loop, vm): @@ -95,7 +97,8 @@ def test_query_error_json(loop, vm): connector=vm._connector, data='{"a": true}', headers={'content-type': 'application/json'}, - params={'b': 1}) + params={'b': 1}, + timeout=300) def test_list_images(loop):