mirror of https://github.com/docker/docker-py.git
Fix #1673 check resource error in container network API
Container network functions checked 'image' as resource ID and not 'container'. This caused a traceback when using container as named argument. Signed-off-by: Matthew Berry <mtberry89@gmail.com>
This commit is contained in:
parent
e0c7e4d60e
commit
a23cd3d8e8
|
@ -200,7 +200,7 @@ class NetworkApiMixin(object):
|
||||||
res = self._get(url, params=params)
|
res = self._get(url, params=params)
|
||||||
return self._result(res, json=True)
|
return self._result(res, json=True)
|
||||||
|
|
||||||
@check_resource('image')
|
@check_resource('container')
|
||||||
@minimum_version('1.21')
|
@minimum_version('1.21')
|
||||||
def connect_container_to_network(self, container, net_id,
|
def connect_container_to_network(self, container, net_id,
|
||||||
ipv4_address=None, ipv6_address=None,
|
ipv4_address=None, ipv6_address=None,
|
||||||
|
@ -237,7 +237,7 @@ class NetworkApiMixin(object):
|
||||||
res = self._post_json(url, data=data)
|
res = self._post_json(url, data=data)
|
||||||
self._raise_for_status(res)
|
self._raise_for_status(res)
|
||||||
|
|
||||||
@check_resource('image')
|
@check_resource('container')
|
||||||
@minimum_version('1.21')
|
@minimum_version('1.21')
|
||||||
def disconnect_container_from_network(self, container, net_id,
|
def disconnect_container_from_network(self, container, net_id,
|
||||||
force=False):
|
force=False):
|
||||||
|
|
|
@ -147,8 +147,8 @@ class NetworkTest(BaseAPIClientTest):
|
||||||
|
|
||||||
with mock.patch('docker.api.client.APIClient.post', post):
|
with mock.patch('docker.api.client.APIClient.post', post):
|
||||||
self.client.connect_container_to_network(
|
self.client.connect_container_to_network(
|
||||||
{'Id': container_id},
|
container={'Id': container_id},
|
||||||
network_id,
|
net_id=network_id,
|
||||||
aliases=['foo', 'bar'],
|
aliases=['foo', 'bar'],
|
||||||
links=[('baz', 'quux')]
|
links=[('baz', 'quux')]
|
||||||
)
|
)
|
||||||
|
@ -176,7 +176,7 @@ class NetworkTest(BaseAPIClientTest):
|
||||||
|
|
||||||
with mock.patch('docker.api.client.APIClient.post', post):
|
with mock.patch('docker.api.client.APIClient.post', post):
|
||||||
self.client.disconnect_container_from_network(
|
self.client.disconnect_container_from_network(
|
||||||
{'Id': container_id}, network_id)
|
container={'Id': container_id}, net_id=network_id)
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
post.call_args[0][0],
|
post.call_args[0][0],
|
||||||
|
|
Loading…
Reference in New Issue