docker_swarm: fix diff mode and details (#53053)

* Fix diff messages for leaving swarm.

* Remove superfluous brakets.
This commit is contained in:
Felix Fontein 2019-02-27 10:07:01 +01:00 committed by ansibot
parent 5dc65d0dfc
commit 8563c2616b

View file

@ -434,7 +434,7 @@ class SwarmManager(DockerBaseClass):
self.client.fail("Swarm not created or other error!")
self.inspect_swarm()
self.results['actions'].append("New Swarm cluster created: %s" % (self.swarm_info.get('ID')))
self.differences.add('state', parameter='absent', active='present')
self.differences.add('state', parameter='present', active='absent')
self.results['changed'] = True
self.results['swarm_facts'] = {u'JoinTokens': self.swarm_info.get('JoinTokens')}
@ -480,7 +480,7 @@ class SwarmManager(DockerBaseClass):
self.results['changed'] = True
def leave(self):
if not(self.client.check_if_swarm_node()):
if not self.client.check_if_swarm_node():
self.results['actions'].append("This node is not part of a swarm.")
return
if not self.check_mode:
@ -493,7 +493,7 @@ class SwarmManager(DockerBaseClass):
self.results['changed'] = True
def remove(self):
if not(self.client.check_if_swarm_manager()):
if not self.client.check_if_swarm_manager():
self.client.fail("This node is not a manager.")
try: