community.docker/plugins/module_utils
Paul Berruti 0525a802bb fix: Match by digest only for combined tag@digest image lookups
When using combined tag@digest references (e.g., nginx:1.21@sha256:abc...),
Docker does NOT store the tag in RepoTags. It only stores the digest in
RepoDigests. The previous implementation required BOTH to match, which
always failed because RepoTags was empty.

This caused docker_container to pull the image on every run even when
the image with the correct digest already existed locally, breaking
idempotency.

The fix: When a digest is specified, match by digest only since it's the
authoritative identifier. The tag is informational for human readability.

Real-world example from docker image inspect:
  "RepoTags": [],  # Empty when pulled by digest\!
  "RepoDigests": ["portainer/portainer-ee@sha256:7ecf2008..."]

Updated tests to reflect the correct behavior:
- test_empty_repo_tags_matches_by_digest (the critical fix case)
- test_combined_tag_digest_matches_even_if_tag_differs
- test_multiple_tags_irrelevant_for_combined
2025-11-23 21:40:32 -08:00
..
_api Fix parse_repository_tag to handle images with both tag and digest 2025-11-22 16:58:54 -08:00
_module_container Improve error/warning messages w.r.t. YAML quoting (#1205) 2025-11-16 12:32:51 +01:00
_common_api.py fix: Handle tag@digest format in pull_image methods 2025-11-23 19:13:11 -08:00
_common_cli.py Work around Docker 29.0.0 bug. (#1187) 2025-11-12 19:21:55 +01:00
_common.py fix: Handle tag@digest format in pull_image methods 2025-11-23 19:13:11 -08:00
_compose_v2.py Fix typing info. (#1183) 2025-11-06 07:15:05 +01:00
_copy.py Cleanup with ruff check (#1182) 2025-10-28 06:58:15 +01:00
_image_archive.py Add typing information, 1/2 (#1176) 2025-10-23 07:05:42 +02:00
_logfmt.py Add typing information, 1/2 (#1176) 2025-10-23 07:05:42 +02:00
_platform.py Add typing information, 1/2 (#1176) 2025-10-23 07:05:42 +02:00
_scramble.py Python code modernization, 8/n (#1179) 2025-10-25 00:36:04 +00:00
_socket_handler.py Cleanup with ruff check (#1182) 2025-10-28 06:58:15 +01:00
_socket_helper.py Cleanup with ruff check (#1182) 2025-10-28 06:58:15 +01:00
_swarm.py Cleanup with ruff check (#1182) 2025-10-28 06:58:15 +01:00
_util.py fix: Match by digest only for combined tag@digest image lookups 2025-11-23 21:40:32 -08:00
_version.py Python code modernization, 2/n (#1156) 2025-10-09 20:46:48 +02:00