1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

apply node_id parameter to swarm node removal (#53503)

This commit is contained in:
Jason Witkowski 2019-03-08 15:58:34 -05:00 committed by jctanner
parent 414440e323
commit be39e757e3
2 changed files with 5 additions and 2 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- docker_swarm - Fixed node_id parameter not working for node removal (https://github.com/ansible/ansible/issues/53501)

View file

@ -395,6 +395,7 @@ class SwarmManager(DockerBaseClass):
self.state = client.module.params['state']
self.force = client.module.params['force']
self.node_id = client.module.params['node_id']
self.differences = DifferenceTracker()
self.parameters = TaskParameters.from_ansible_params(client)
@ -512,7 +513,7 @@ class SwarmManager(DockerBaseClass):
self.client.fail("This node is not a manager.")
try:
status_down = self.client.check_if_swarm_node_is_down(repeat_check=5)
status_down = self.client.check_if_swarm_node_is_down(node_id=self.node_id, repeat_check=5)
except APIError:
return
@ -521,7 +522,7 @@ class SwarmManager(DockerBaseClass):
if not self.check_mode:
try:
self.client.remove_node(node_id=self.parameters.node_id, force=self.force)
self.client.remove_node(node_id=self.node_id, force=self.force)
except APIError as exc:
self.client.fail("Can not remove the node from the Swarm Cluster: %s" % to_native(exc))
self.results['actions'].append("Node is removed from swarm cluster.")