Add docker network IPAM options parameter

Signed-off-by: Walker Lee <walkerlee.tw@gmail.com>
This commit is contained in:
Walker Lee 2016-10-27 00:12:56 +08:00
parent c7dabbfa37
commit a3981f891d
No known key found for this signature in database
GPG Key ID: 89D8001A0332C699
4 changed files with 11 additions and 4 deletions

View File

@ -47,10 +47,14 @@ def create_ipam_pool(subnet=None, iprange=None, gateway=None,
}
def create_ipam_config(driver='default', pool_configs=None):
def create_ipam_config(driver='default', pool_configs=None, options=None):
if options is not None and not isinstance(options, dict):
raise TypeError('IPAM options must be a dictionary')
return {
'Driver': driver,
'Config': pool_configs or []
'Config': pool_configs or [],
'Options': options
}

View File

@ -137,6 +137,7 @@ Create an IPAM (IP Address Management) config dictionary to be used with
* driver (str): The IPAM driver to use. Defaults to `'default'`.
* pool_configs (list): A list of pool configuration dictionaries as created
by `docker.utils.create_ipam_pool`. Defaults to empty list.
* options (dict): Driver options as a key-value dictionary. Defaults to `None`.
**Returns** An IPAM config dictionary

View File

@ -100,7 +100,8 @@ class NetworkTest(DockerClientTest):
"Gateway": "192.168.52.254",
"Subnet": "192.168.52.0/24",
"AuxiliaryAddresses": None,
}]
}],
"Options": None
}
})

View File

@ -691,7 +691,8 @@ class UtilsTest(base.BaseTestCase):
'Gateway': '192.168.52.254',
'AuxiliaryAddresses': None,
'IPRange': None,
}]
}],
'Options': None
})