apply node_id parameter to swarm node removal (#53503)
This commit is contained in:
parent
414440e323
commit
be39e757e3
2 changed files with 5 additions and 2 deletions
2
changelogs/fragments/53503-docker_swarm_fix_node_id.yml
Normal file
2
changelogs/fragments/53503-docker_swarm_fix_node_id.yml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
bugfixes:
|
||||||
|
- docker_swarm - Fixed node_id parameter not working for node removal (https://github.com/ansible/ansible/issues/53501)
|
|
@ -395,6 +395,7 @@ class SwarmManager(DockerBaseClass):
|
||||||
|
|
||||||
self.state = client.module.params['state']
|
self.state = client.module.params['state']
|
||||||
self.force = client.module.params['force']
|
self.force = client.module.params['force']
|
||||||
|
self.node_id = client.module.params['node_id']
|
||||||
|
|
||||||
self.differences = DifferenceTracker()
|
self.differences = DifferenceTracker()
|
||||||
self.parameters = TaskParameters.from_ansible_params(client)
|
self.parameters = TaskParameters.from_ansible_params(client)
|
||||||
|
@ -512,7 +513,7 @@ class SwarmManager(DockerBaseClass):
|
||||||
self.client.fail("This node is not a manager.")
|
self.client.fail("This node is not a manager.")
|
||||||
|
|
||||||
try:
|
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:
|
except APIError:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -521,7 +522,7 @@ class SwarmManager(DockerBaseClass):
|
||||||
|
|
||||||
if not self.check_mode:
|
if not self.check_mode:
|
||||||
try:
|
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:
|
except APIError as exc:
|
||||||
self.client.fail("Can not remove the node from the Swarm Cluster: %s" % to_native(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.")
|
self.results['actions'].append("Node is removed from swarm cluster.")
|
||||||
|
|
Loading…
Reference in a new issue