mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
docker_swarm: fix idempotency (#52976)
* Improve idempotency checking: only consider parameters which are part of the generated spec. * Properly handle rotate_worker_token and rotate_manager_token.
This commit is contained in:
parent
6f585b6ee9
commit
42ae6cdb95
2 changed files with 7 additions and 1 deletions
|
@ -1,2 +1,3 @@
|
|||
bugfixes:
|
||||
- "docker_swarm - do not crash with older docker daemons (https://github.com/ansible/ansible/issues/51175)."
|
||||
- "docker_swarm - improve idempotency checking; ``rotate_worker_token`` and ``rotate_manager_token`` are now also used when all other parameters have not changed."
|
||||
|
|
|
@ -349,12 +349,17 @@ class TaskParameters(DockerBaseClass):
|
|||
|
||||
def compare_to_active(self, other, differences):
|
||||
for k in self.__dict__:
|
||||
if k in ('advertise_addr', 'listen_addr', 'rotate_worker_token', 'rotate_manager_token', 'spec'):
|
||||
if k in ('advertise_addr', 'listen_addr', 'force_new_cluster', 'remote_addrs',
|
||||
'join_token', 'force', 'rotate_worker_token', 'rotate_manager_token', 'spec'):
|
||||
continue
|
||||
if self.__dict__[k] is None:
|
||||
continue
|
||||
if self.__dict__[k] != other.__dict__[k]:
|
||||
differences.add(k, parameter=self.__dict__[k], active=other.__dict__[k])
|
||||
if self.rotate_worker_token:
|
||||
differences.add('rotate_worker_token', parameter=True, active=False)
|
||||
if self.rotate_manager_token:
|
||||
differences.add('rotate_manager_token', parameter=True, active=False)
|
||||
return differences
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue