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

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