-
Notifications
You must be signed in to change notification settings - Fork 175
Conversation
iso/step_add_floppy.go
Outdated
state.Put("error", err) | ||
} | ||
|
||
deletePath := fmt.Sprintf("%v/packer-tmp-created-floppy.flp", vmDir) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we get the filename from the state instead of hardcoding it?
https://github.com/jetbrains-infra/packer-builder-vsphere/blob/master/iso/step_remove_floppy.go#L33
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. Because we could be faced with a situation: when the file uploaded, but the state not have information about uploadPath.
packer-builder-vsphere/iso/step_add_floppy.go
Lines 42 to 47 in a00a2ad
uploadPath := fmt.Sprintf("%v/packer-tmp-created-floppy.flp", vmDir) | |
if err := ds.UploadFile(floppyPath.(string), uploadPath); err != nil { | |
state.Put("error", err) | |
return multistep.ActionHalt | |
} | |
state.Put("uploaded_floppy_path", uploadPath) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
then that's not our business. If govmomi returns an error during uploading, it should handle cleanup by itself.
iso/step_add_floppy.go
Outdated
ui := state.Get("ui").(packer.Ui) | ||
|
||
std := state.Get("driver") | ||
if std == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't need this check
iso/step_add_floppy.go
Outdated
state.Put("error", err) | ||
} | ||
|
||
if err := ds.Delete(UploadedFloppyPath.(string)); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there are two styles
ds, err := d.FindDatastore(s.Datastore, s.Host)
if err != nil {
and
if err := ds.Delete(UploadedFloppyPath.(string)); err != nil {
we mostly use the 1st.
3e5ccaa
to
b8676c3
Compare
fixes #137