mirror of https://github.com/docker/docker-py.git
Return node id on swarm init
Signed-off-by: Hannes Ljungberg <hannes@5monkeys.se>
This commit is contained in:
parent
992e0dcdfb
commit
acd7a8f430
|
|
@ -117,7 +117,7 @@ class SwarmApiMixin(object):
|
|||
networks created from the default subnet pool. Default: None
|
||||
|
||||
Returns:
|
||||
``True`` if successful.
|
||||
(str): The ID of the created node.
|
||||
|
||||
Raises:
|
||||
:py:class:`docker.errors.APIError`
|
||||
|
|
@ -155,8 +155,7 @@ class SwarmApiMixin(object):
|
|||
'Spec': swarm_spec,
|
||||
}
|
||||
response = self._post_json(url, data=data)
|
||||
self._raise_for_status(response)
|
||||
return True
|
||||
return self._result(response, json=True)
|
||||
|
||||
@utils.minimum_version('1.24')
|
||||
def inspect_swarm(self):
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ class Swarm(Model):
|
|||
created in the orchestrator.
|
||||
|
||||
Returns:
|
||||
``True`` if the request went through.
|
||||
(str): The ID of the created node.
|
||||
|
||||
Raises:
|
||||
:py:class:`docker.errors.APIError`
|
||||
|
|
@ -120,9 +120,9 @@ class Swarm(Model):
|
|||
'subnet_size': subnet_size
|
||||
}
|
||||
init_kwargs['swarm_spec'] = self.client.api.create_swarm_spec(**kwargs)
|
||||
self.client.api.init_swarm(**init_kwargs)
|
||||
node_id = self.client.api.init_swarm(**init_kwargs)
|
||||
self.reload()
|
||||
return True
|
||||
return node_id
|
||||
|
||||
def join(self, *args, **kwargs):
|
||||
return self.client.api.join_swarm(*args, **kwargs)
|
||||
|
|
|
|||
|
|
@ -186,12 +186,14 @@ class SwarmTest(BaseAPIIntegrationTest):
|
|||
|
||||
@requires_api_version('1.24')
|
||||
def test_inspect_node(self):
|
||||
assert self.init_swarm()
|
||||
node_id = self.init_swarm()
|
||||
assert node_id
|
||||
nodes_list = self.client.nodes()
|
||||
assert len(nodes_list) == 1
|
||||
node = nodes_list[0]
|
||||
node_data = self.client.inspect_node(node['ID'])
|
||||
assert node['ID'] == node_data['ID']
|
||||
assert node_id == node['ID']
|
||||
assert node['Version'] == node_data['Version']
|
||||
|
||||
@requires_api_version('1.24')
|
||||
|
|
|
|||
Loading…
Reference in New Issue