Description
I am using docker-2.0.0 and the connect method of Network class has some documented parameters such as "ipv4_address" that is not implemented in Network yet. When calling connect with "ipv4_address" argument, this exception is thrown:
TypeError: connect() got an unexpected keyword argument 'ipv4_address'
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/ContainerManager.py", line 178, in create_container
self.test_network.connect(container=container.id, ipv4_address= new_container_ip_address)
I found that the low level API method "connect_container_to_network" this functionality. So the "connect" method of Network class must be changed to use this parameters of low level API. like this:
def connect(self, container, ipv4_address=None, ipv6_address=None, aliases=None, links=None, link_local_ips=None):
"""
Connect a container to this network.
Args:
container (str): Container to connect to this network, as either
an ID, name, or :py:class:`~docker.models.containers.Container`
object.
aliases (list): A list of aliases for this endpoint. Names in that
list can be used within the network to reach the container.
Defaults to ``None``.
links (list): A list of links for this endpoint. Containers
declared in this list will be linkedto this container.
Defaults to ``None``.
ipv4_address (str): The IP address of this container on the
network, using the IPv4 protocol. Defaults to ``None``.
ipv6_address (str): The IP address of this container on the
network, using the IPv6 protocol. Defaults to ``None``.
link_local_ips (list): A list of link-local (IPv4/IPv6) addresses.
Raises:
:py:class:`docker.errors.APIError`
If the server returns an error.
"""
if isinstance(container, Container):
container = container.id
return self.client.api.connect_container_to_network(container, self.id, ipv4_address=ipv4_address, ipv6_address=ipv6_address, aliases=aliases, links=links, link_local_ips=link_local_ips)