Skip to content

Commit

Permalink
more details in case of shared dir for blobs
Browse files Browse the repository at this point in the history
  • Loading branch information
Pvlerick committed Sep 4, 2023
1 parent 7d213d3 commit 4c59a25
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions oci/layout/oci_delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,17 +79,28 @@ func (ref ociReference) DeleteImage(ctx context.Context, sys *types.SystemContex
if err != nil {
return err
}

_, err = os.Stat(blobPath)
if err == nil {
logrus.Debug("Deleting blob ", digest.Hex())
err = os.Remove(blobPath)
if err != nil && !os.IsNotExist(err) {
return err
}
//
} else {
if os.IsNotExist(err) {
logrus.Info("Blob ", digest.Hex(), " not found in image directory; it was either previously deleted or is in the shared blobs directory")
potentialBlobPathInSharedDir, err := ref.blobPath(digest, sharedBlobsDir)
if err != nil {
return err
}
_, err = os.Stat(potentialBlobPathInSharedDir)
if err == nil {
logrus.Debug("Blob ", digest.Hex(), " is in the the shared blobs directory, leaving it")
} else if os.IsNotExist(err) {
logrus.Info("Blob ", digest.Hex(), " not found either in image directory nor shared directory")
} else {
return err
}
} else {
return err
}
Expand Down

0 comments on commit 4c59a25

Please sign in to comment.