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 13, 2023
1 parent 12cf968 commit 7c1ec30
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 7c1ec30

Please sign in to comment.