27 lines
624 B
Go
27 lines
624 B
Go
package iso
|
|
|
|
import (
|
|
"context"
|
|
"github.com/hashicorp/packer/builder/vsphere/driver"
|
|
"github.com/hashicorp/packer/helper/multistep"
|
|
"github.com/hashicorp/packer/packer"
|
|
)
|
|
|
|
type StepRemoveCDRom struct{}
|
|
|
|
func (s *StepRemoveCDRom) Run(_ context.Context, state multistep.StateBag) multistep.StepAction {
|
|
ui := state.Get("ui").(packer.Ui)
|
|
vm := state.Get("vm").(*driver.VirtualMachine)
|
|
|
|
ui.Say("Eject CD-ROM drives...")
|
|
err := vm.EjectCdroms()
|
|
if err != nil {
|
|
state.Put("error", err)
|
|
return multistep.ActionHalt
|
|
}
|
|
|
|
return multistep.ActionContinue
|
|
}
|
|
|
|
func (s *StepRemoveCDRom) Cleanup(state multistep.StateBag) {}
|