Skip to content

Commit

Permalink
warn user instead of error when image does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
tripolkaandrey committed Mar 23, 2021
1 parent 9bb16bb commit b7976f6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pkg/minikube/image/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import (
"k8s.io/klog/v2"
"k8s.io/minikube/pkg/minikube/constants"
"k8s.io/minikube/pkg/minikube/localpath"
"k8s.io/minikube/pkg/minikube/out"
"k8s.io/minikube/pkg/util/lock"
)

Expand Down Expand Up @@ -71,8 +72,11 @@ func SaveToDir(images []string, cacheDir string) error {
dst := filepath.Join(cacheDir, image)
dst = localpath.SanitizeCacheDir(dst)
if err := saveToTarFile(image, dst); err != nil {
klog.Errorf("save image to file %q -> %q failed: %v", image, dst, err)
return errors.Wrapf(err, "caching image %q", dst)
if err == errCacheImageDoesntExist {
out.WarningT("The image you are trying to add {{.imageName}} doesn't exist!", out.V{"imageName": image})
} else {
return errors.Wrapf(err, "caching image %q", dst)
}
}
klog.Infof("save to tar file %s -> %s succeeded", image, dst)
return nil
Expand Down

0 comments on commit b7976f6

Please sign in to comment.