diff options
| author | Hannes Ljungberg <hannes@5monkeys.se> | 2019-03-22 16:55:10 +0100 |
|---|---|---|
| committer | Hannes Ljungberg <hannes@5monkeys.se> | 2019-03-22 20:30:17 +0100 |
| commit | 68a271cef4e2afe881d5c4dfe18a97496dc3adb0 (patch) | |
| tree | 1a8b5039901955b25faef2d3c4c3d2f1c10f7aeb | |
| parent | d6cc972cd9955b1aadd373391673314f79e82679 (diff) | |
| download | docker-py-68a271cef4e2afe881d5c4dfe18a97496dc3adb0.tar.gz | |
Fix documentation and order of arguments
Following https://github.com/docker/docker-py/pull/2201#pullrequestreview-192571911
Signed-off-by: Hannes Ljungberg <hannes@5monkeys.se>
Co-authored-by: Hannes Ljungberg <hannes@5monkeys.se>
Co-authored-by: bluikko <14869000+bluikko@users.noreply.github.com>
| -rw-r--r-- | docker/api/swarm.py | 17 | ||||
| -rw-r--r-- | docker/models/swarm.py | 18 |
2 files changed, 17 insertions, 18 deletions
diff --git a/docker/api/swarm.py b/docker/api/swarm.py index 4a39782..e7db5e2 100644 --- a/docker/api/swarm.py +++ b/docker/api/swarm.py @@ -83,8 +83,8 @@ class SwarmApiMixin(object): @utils.minimum_version('1.24') def init_swarm(self, advertise_addr=None, listen_addr='0.0.0.0:2377', - default_addr_pool=None, subnet_size=None, - force_new_cluster=False, swarm_spec=None): + force_new_cluster=False, swarm_spec=None, + default_addr_pool=None, subnet_size=None): """ Initialize a new Swarm using the current connected engine as the first node. @@ -104,17 +104,17 @@ class SwarmApiMixin(object): or an interface followed by a port number, like ``eth0:4567``. If the port number is omitted, the default swarm listening port is used. Default: '0.0.0.0:2377' - default_addr_pool (list of strings): Default Address Pool specifies - default subnet pools for global scope networks. Each pool - should be specified as a CIDR block, like '10.0.0.0/16'. - Default: None - subnet_size (int): SubnetSize specifies the subnet size of the - networks created from the default subnet pool. Default: None force_new_cluster (bool): Force creating a new Swarm, even if already part of one. Default: False swarm_spec (dict): Configuration settings of the new Swarm. Use ``APIClient.create_swarm_spec`` to generate a valid configuration. Default: None + default_addr_pool (list of strings): Default Address Pool specifies + default subnet pools for global scope networks. Each pool + should be specified as a CIDR block, like '10.0.0.0/8'. + Default: None + subnet_size (int): SubnetSize specifies the subnet size of the + networks created from the default subnet pool. Default: None Returns: ``True`` if successful. @@ -125,7 +125,6 @@ class SwarmApiMixin(object): """ url = self._url('/swarm/init') - if swarm_spec is not None and not isinstance(swarm_spec, dict): raise TypeError('swarm_spec must be a dictionary') diff --git a/docker/models/swarm.py b/docker/models/swarm.py index 1106ce2..cb27467 100644 --- a/docker/models/swarm.py +++ b/docker/models/swarm.py @@ -34,8 +34,8 @@ class Swarm(Model): get_unlock_key.__doc__ = APIClient.get_unlock_key.__doc__ def init(self, advertise_addr=None, listen_addr='0.0.0.0:2377', - default_addr_pool=None, subnet_size=None, - force_new_cluster=False, **kwargs): + force_new_cluster=False, default_addr_pool=None, + subnet_size=None, **kwargs): """ Initialize a new swarm on this Engine. @@ -55,14 +55,14 @@ class Swarm(Model): or an interface followed by a port number, like ``eth0:4567``. If the port number is omitted, the default swarm listening port is used. Default: ``0.0.0.0:2377`` + force_new_cluster (bool): Force creating a new Swarm, even if + already part of one. Default: False default_addr_pool (list of str): Default Address Pool specifies default subnet pools for global scope networks. Each pool - should be specified as a CIDR block, like '10.0.0.0/16'. + should be specified as a CIDR block, like '10.0.0.0/8'. Default: None subnet_size (int): SubnetSize specifies the subnet size of the networks created from the default subnet pool. Default: None - force_new_cluster (bool): Force creating a new Swarm, even if - already part of one. Default: False task_history_retention_limit (int): Maximum number of tasks history stored. snapshot_interval (int): Number of logs entries between snapshot. @@ -106,8 +106,8 @@ class Swarm(Model): >>> client.swarm.init( advertise_addr='eth0', listen_addr='0.0.0.0:5000', - default_addr_pool=['10.20.0.0/16], subnet_size=24, - force_new_cluster=False, snapshot_interval=5000, + force_new_cluster=False, default_addr_pool=['10.20.0.0/16], + subnet_size=24, snapshot_interval=5000, log_entries_for_slow_followers=1200 ) @@ -115,9 +115,9 @@ class Swarm(Model): init_kwargs = { 'advertise_addr': advertise_addr, 'listen_addr': listen_addr, + 'force_new_cluster': force_new_cluster, 'default_addr_pool': default_addr_pool, - 'subnet_size': subnet_size, - 'force_new_cluster': force_new_cluster + 'subnet_size': subnet_size } init_kwargs['swarm_spec'] = self.client.api.create_swarm_spec(**kwargs) self.client.api.init_swarm(**init_kwargs) |
