Skip to content

Commit 4669b24

Browse files
committed
Add options to IPAMConfig
Signed-off-by: Joffrey F <[email protected]>
1 parent de89ee6 commit 4669b24

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

docker/types/networks.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,19 +50,26 @@ class IPAMConfig(dict):
5050
driver (str): The IPAM driver to use. Defaults to ``default``.
5151
pool_configs (list): A list of pool configurations
5252
(:py:class:`~docker.types.IPAMPool`). Defaults to empty list.
53+
options (dict): Driver options as a key-value dictionary.
54+
Defaults to `None`.
5355
5456
Example:
5557
5658
>>> ipam_config = docker.types.IPAMConfig(driver='default')
5759
>>> network = client.create_network('network1', ipam=ipam_config)
5860
5961
"""
60-
def __init__(self, driver='default', pool_configs=None):
62+
def __init__(self, driver='default', pool_configs=None, options=None):
6163
self.update({
6264
'Driver': driver,
6365
'Config': pool_configs or []
6466
})
6567

68+
if options:
69+
if not isinstance(options, dict):
70+
raise TypeError('IPAMConfig options must be a dictionary')
71+
self['Options'] = options
72+
6673

6774
class IPAMPool(dict):
6875
"""

0 commit comments

Comments
 (0)