2013-12-24 00:58:41 -05:00
|
|
|
package iso
|
2013-11-08 15:19:09 -05:00
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"github.com/mitchellh/multistep"
|
2013-12-24 13:31:57 -05:00
|
|
|
vmwcommon "github.com/mitchellh/packer/builder/vmware/common"
|
2013-11-08 15:19:09 -05:00
|
|
|
"github.com/mitchellh/packer/packer"
|
|
|
|
"log"
|
|
|
|
)
|
|
|
|
|
|
|
|
// This step suppresses any messages that VMware product might show.
|
|
|
|
type stepSuppressMessages struct{}
|
|
|
|
|
|
|
|
func (s *stepSuppressMessages) Run(state multistep.StateBag) multistep.StepAction {
|
2013-12-24 13:31:57 -05:00
|
|
|
driver := state.Get("driver").(vmwcommon.Driver)
|
2013-11-08 15:19:09 -05:00
|
|
|
ui := state.Get("ui").(packer.Ui)
|
|
|
|
vmxPath := state.Get("vmx_path").(string)
|
|
|
|
|
|
|
|
log.Println("Suppressing messages in VMX")
|
|
|
|
if err := driver.SuppressMessages(vmxPath); err != nil {
|
|
|
|
err := fmt.Errorf("Error suppressing messages: %s", err)
|
|
|
|
state.Put("error", err)
|
|
|
|
ui.Error(err.Error())
|
|
|
|
return multistep.ActionHalt
|
|
|
|
}
|
|
|
|
|
|
|
|
return multistep.ActionContinue
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *stepSuppressMessages) Cleanup(state multistep.StateBag) {}
|