Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions lib/install/management/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,16 @@ func (d *Dispatcher) uploadImages(files map[string]string) error {

isoTargetPath := path.Join(d.vmPathName, key)
// check iso first
d.op.Debugf("target delete path = %s", isoTargetPath)
_, err := ds.Stat(d.op, isoTargetPath)
if err != nil {
switch err.(type) {
case object.DatastoreNoSuchFileError:
// if not found, do nothing
d.op.Debug("File not found. Nothing to do.")
case object.DatastoreNoSuchDirectoryError:
d.op.Debug("Directory not found. Nothing to do.")
default:
// otherwise force delete
d.op.Debugf("target delete path = %s", isoTargetPath)
err := fm.Delete(d.op, isoTargetPath)
if err != nil {
d.op.Debugf("Failed to delete image (%s) with error (%s)", image, err.Error())
Expand Down