Skip to content

Commit

Permalink
When using additional stores, report id only once
Browse files Browse the repository at this point in the history
Currently if you setup additional stores and pull the same
image that exists in additionalstore, podman ends up reporting
the ID twice.

Fixes: containers/podman#18647

Signed-off-by: Daniel J Walsh <[email protected]>
  • Loading branch information
rhatdan committed Jun 12, 2023
1 parent 3d71cc7 commit 9e7b16f
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion libimage/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -442,8 +442,17 @@ func (r *Runtime) imagesIDsForManifest(manifestBytes []byte, sys *types.SystemCo
if err != nil {
return nil, fmt.Errorf("listing images by manifest digest: %w", err)
}
results := make([]string, 0, len(images))

// If you have additionStores defined and the same image stored in
// both storage and additional store, it can be output twice.
// Fixes github.com/containers/podman/issues/18647
results := []string{}
imageMap := map[string]bool{}
for _, image := range images {
if imageMap[image.ID] {
continue
}
imageMap[image.ID] = true
results = append(results, image.ID)
}
if len(results) == 0 {
Expand Down

0 comments on commit 9e7b16f

Please sign in to comment.