27 lines
630 B
Go
27 lines
630 B
Go
package iso
|
|
|
|
import (
|
|
"github.com/hashicorp/packer/packer"
|
|
"github.com/jetbrains-infra/packer-builder-vsphere/driver"
|
|
"github.com/hashicorp/packer/helper/multistep"
|
|
"context"
|
|
)
|
|
|
|
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) {}
|