Remove a dependency on libimage from pkg/bindings

... by updating for a c/common API change.

[NO NEW TESTS NEEDED]: Only moves unchanged code,
should not change behavior.

Signed-off-by: Miloslav Trmač <mitr@redhat.com>
This commit is contained in:
Miloslav Trmač
2023-08-28 23:22:42 +02:00
parent b4aed53ea6
commit a3c2d6ad2e
9 changed files with 45 additions and 37 deletions

View File

@@ -91,13 +91,14 @@ func (i *Image) isCorrupted(name string) error {
return err
}
if _, err := ref.NewImage(context.Background(), nil); err != nil {
img, err := ref.NewImage(context.Background(), nil)
if err != nil {
if name == "" {
name = i.ID()[:12]
}
return fmt.Errorf("Image %s exists in local storage but may be corrupted (remove the image to resolve the issue): %v", name, err)
}
return nil
return img.Close()
}
// Names returns associated names with the image which may be a mix of tags and
@@ -872,6 +873,7 @@ func (i *Image) hasDifferentDigestWithSystemContext(ctx context.Context, remoteR
if err != nil {
return false, err
}
defer remoteImg.Close()
rawManifest, rawManifestMIMEType, err := remoteImg.Manifest(ctx)
if err != nil {