mirror of https://github.com/docker/docker-py.git
Merge pull request #2296 from hannseman/swarm-init-response
Return node id on swarm init
This commit is contained in:
commit
4d62dd0a64
|
@ -120,7 +120,7 @@ class SwarmApiMixin(object):
|
|||
traffic. For example, 192.168.1.1, or an interface, like eth0.
|
||||
|
||||
Returns:
|
||||
``True`` if successful.
|
||||
(str): The ID of the created node.
|
||||
|
||||
Raises:
|
||||
:py:class:`docker.errors.APIError`
|
||||
|
@ -167,8 +167,7 @@ class SwarmApiMixin(object):
|
|||
data['DataPathAddr'] = data_path_addr
|
||||
|
||||
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):
|
||||
|
|
|
@ -98,7 +98,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`
|
||||
|
@ -123,9 +123,9 @@ class Swarm(Model):
|
|||
'data_path_addr': data_path_addr,
|
||||
}
|
||||
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