machine: ocipull do not error if downloaddir exists

If users cancel the image download with CTRL-C for example then the
blob dir will stay around. The next time we run the download we should
just start the download again and not complain about the existing
directory.

[NO NEW TESTS NEEDED]

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
Paul Holzinger
2024-02-15 14:45:42 +01:00
parent e595441891
commit bcec7e6279

View File

@ -28,10 +28,6 @@ type PullOptions struct {
// Pull `imageInput` from a container registry to `sourcePath`.
func Pull(ctx context.Context, imageInput types.ImageReference, localDestPath *define.VMFile, options *PullOptions) error {
if _, err := os.Stat(localDestPath.GetPath()); err == nil {
return fmt.Errorf("%q already exists", localDestPath.GetPath())
}
destRef, err := layout.ParseReference(localDestPath.GetPath())
if err != nil {
return err