Fix pull change detection. (#1242) (#1243)

(cherry picked from commit c2e48a1ae3)
This commit is contained in:
Felix Fontein 2026-02-11 22:38:18 +01:00 committed by GitHub
parent 4adf0ed22f
commit 7b45d96c94
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 1 deletions

View File

@ -0,0 +1,2 @@
bugfixes:
- "docker_image_pull, docker_container - fix pulled image change detection for Docker 29.2+ (https://github.com/ansible-collections/community.docker/pull/1242)."

View File

@ -424,7 +424,10 @@ class AnsibleDockerClientBase(Client):
def _compare_images(img1, img2): def _compare_images(img1, img2):
if img1 is None or img2 is None: if img1 is None or img2 is None:
return img1 == img2 return img1 == img2
filter_keys = {"Metadata"} filter_keys = {"Metadata", "Identity"}
# Since Docker 29.2 (?) the order of entries in Identity.Pull can change
# even though the image is the same. Since we're only really interested
# in the image's Id field, we simply skip all of Identity.
img1_filtered = {k: v for k, v in img1.items() if k not in filter_keys} img1_filtered = {k: v for k, v in img1.items() if k not in filter_keys}
img2_filtered = {k: v for k, v in img2.items() if k not in filter_keys} img2_filtered = {k: v for k, v in img2.items() if k not in filter_keys}
return img1_filtered == img2_filtered return img1_filtered == img2_filtered