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:
parent
9cc9ca584a
commit
1be69cd69c
1 changed files with 5 additions and 8 deletions
|
@ -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()
|
||||||
|
|
Loading…
Reference in a new issue