Clean up of docker swarm service (#45525)

* Remove redundant assignation of variable

Found with https://lgtm.com/

* Fix check_mode when force_update is used
This commit is contained in:
Michael Scherer 2018-10-17 23:29:47 +02:00 committed by ansibot
parent 9cc9ca584a
commit 1be69cd69c

View file

@ -1069,7 +1069,6 @@ class DockerServiceManager():
else: else:
changed, changes, need_rebuild, force_update = new_service.compare(current_service) changed, changes, need_rebuild, force_update = new_service.compare(current_service)
if changed: if changed:
changed = True
if need_rebuild: if need_rebuild:
if not module.check_mode: if not module.check_mode:
self.remove_service(module.params['name']) self.remove_service(module.params['name'])
@ -1077,7 +1076,6 @@ class DockerServiceManager():
new_service) new_service)
msg = 'Service rebuilt' msg = 'Service rebuilt'
rebuilt = True rebuilt = True
changes = changes
else: else:
if not module.check_mode: if not module.check_mode:
self.update_service(module.params['name'], self.update_service(module.params['name'],
@ -1085,16 +1083,15 @@ class DockerServiceManager():
new_service) new_service)
msg = 'Service updated' msg = 'Service updated'
rebuilt = False rebuilt = False
changes = changes
else: else:
if force_update and not module.check_mode: if force_update:
self.update_service(module.params['name'], if not module.check_mode:
current_service, self.update_service(module.params['name'],
new_service) current_service,
new_service)
msg = 'Service forcefully updated' msg = 'Service forcefully updated'
rebuilt = False rebuilt = False
changed = True changed = True
changes = changes
else: else:
msg = 'Service unchanged' msg = 'Service unchanged'
facts = new_service.get_facts() facts = new_service.get_facts()