Skip to content

Commit

Permalink
Merge pull request #70 from Vanilla-OS/image-fix
Browse files Browse the repository at this point in the history
Fixes for image-operations
  • Loading branch information
mirkobrombin authored Jun 7, 2023
2 parents eba1bf3 + 69f793d commit 2e0cb50
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 3 additions & 2 deletions core/oci.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"path/filepath"

"github.com/containers/buildah"
cstypes "github.com/containers/storage/types"
"github.com/vanilla-os/abroot/settings"
"github.com/vanilla-os/prometheus"
)
Expand Down Expand Up @@ -146,7 +147,7 @@ func FindImageWithLabel(key, value string) (string, error) {
return "", nil
}

// DeleteImageForRoot retrieves the image created for the provided root ("vos-a"|"vos-b")
// RetrieveImageForRoot retrieves the image created for the provided root ("vos-a"|"vos-b")
func RetrieveImageForRoot(root string) (string, error) {
PrintVerbose("ApplyInImageForRoot: running...")

Expand Down Expand Up @@ -178,7 +179,7 @@ func DeleteImageForRoot(root string) error {
}

_, err = pt.Store.DeleteImage(image, true)
if err != nil {
if err != nil && err != cstypes.ErrNotAnImage {
PrintVerbose("DeleteImageForRoot:err(3): %s", err)
return err
}
Expand Down
4 changes: 4 additions & 0 deletions core/system.go
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,10 @@ func (s *ABSystem) RunOperation(operation ABSystemOperation) error {
PrintVerbose("ABSystemRunOperation:err(3.3): %s", err)
return err
}
// Handle case where an image for the current root may not exist in storage
if imageName == "" {
imageName = settings.Cnf.FullImageName
}
} else {
imageName = strings.Split(settings.Cnf.FullImageName, ":")[0] + "@" + imageDigest
labels["ABRoot.BaseImageDigest"] = s.CurImage.Digest
Expand Down

0 comments on commit 2e0cb50

Please sign in to comment.