mirror of https://github.com/docker/docker-py.git
Merge pull request #1330 from docker/walkerlee-master
Add options to IPAMConfig
This commit is contained in:
commit
32cd0161b6
|
@ -50,6 +50,8 @@ class IPAMConfig(dict):
|
|||
driver (str): The IPAM driver to use. Defaults to ``default``.
|
||||
pool_configs (list): A list of pool configurations
|
||||
(:py:class:`~docker.types.IPAMPool`). Defaults to empty list.
|
||||
options (dict): Driver options as a key-value dictionary.
|
||||
Defaults to `None`.
|
||||
|
||||
Example:
|
||||
|
||||
|
@ -57,12 +59,17 @@ class IPAMConfig(dict):
|
|||
>>> network = client.create_network('network1', ipam=ipam_config)
|
||||
|
||||
"""
|
||||
def __init__(self, driver='default', pool_configs=None):
|
||||
def __init__(self, driver='default', pool_configs=None, options=None):
|
||||
self.update({
|
||||
'Driver': driver,
|
||||
'Config': pool_configs or []
|
||||
})
|
||||
|
||||
if options:
|
||||
if not isinstance(options, dict):
|
||||
raise TypeError('IPAMConfig options must be a dictionary')
|
||||
self['Options'] = options
|
||||
|
||||
|
||||
class IPAMPool(dict):
|
||||
"""
|
||||
|
|
|
@ -100,7 +100,7 @@ class NetworkTest(BaseAPIClientTest):
|
|||
"Gateway": "192.168.52.254",
|
||||
"Subnet": "192.168.52.0/24",
|
||||
"AuxiliaryAddresses": None,
|
||||
}]
|
||||
}],
|
||||
}
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in New Issue