mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
docker_container.running sort list of links
When the docker_container.running module is comparing the defined state and the current state of a container, the list of linked containers in the current state is is a non-deterministic order. This results in a container recreation even though the links are the same (just in a different order). This patches the comparison function to lexically sort both the existing and desired list of links, making the comparison deterministic and not recreating a container when the links have not changed. Fixes #44258.
This commit is contained in:
parent
bd5b9dd0aa
commit
ae34a15503
1 changed files with 4 additions and 4 deletions
|
@ -910,8 +910,8 @@ def compare_container(first, second, ignore=None):
|
|||
ret.setdefault(conf_dict, {})[item] = {'old': image1, 'new': image2}
|
||||
else:
|
||||
if item == 'Links':
|
||||
val1 = _scrub_links(val1, first)
|
||||
val2 = _scrub_links(val2, second)
|
||||
val1 = sorted(_scrub_links(val1, first))
|
||||
val2 = sorted(_scrub_links(val2, second))
|
||||
if val1 != val2:
|
||||
ret.setdefault(conf_dict, {})[item] = {'old': val1, 'new': val2}
|
||||
# Check for optionally-present items that were in the second container
|
||||
|
@ -933,8 +933,8 @@ def compare_container(first, second, ignore=None):
|
|||
ret.setdefault(conf_dict, {})[item] = {'old': image1, 'new': image2}
|
||||
else:
|
||||
if item == 'Links':
|
||||
val1 = _scrub_links(val1, first)
|
||||
val2 = _scrub_links(val2, second)
|
||||
val1 = sorted(_scrub_links(val1, first))
|
||||
val2 = sorted(_scrub_links(val2, second))
|
||||
if val1 != val2:
|
||||
ret.setdefault(conf_dict, {})[item] = {'old': val1, 'new': val2}
|
||||
return ret
|
||||
|
|
Loading…
Add table
Reference in a new issue