2013-12-24 16:26:44 -05:00
|
|
|
package common
|
2013-11-08 15:19:09 -05:00
|
|
|
|
|
|
|
import (
|
2018-01-22 18:32:33 -05:00
|
|
|
"context"
|
2013-11-08 15:19:09 -05:00
|
|
|
"fmt"
|
2018-01-22 18:32:33 -05:00
|
|
|
"log"
|
|
|
|
|
2018-01-19 19:18:44 -05:00
|
|
|
"github.com/hashicorp/packer/helper/multistep"
|
2017-04-04 16:39:01 -04:00
|
|
|
"github.com/hashicorp/packer/packer"
|
2013-11-08 15:19:09 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
// This step suppresses any messages that VMware product might show.
|
2013-12-24 16:26:44 -05:00
|
|
|
type StepSuppressMessages struct{}
|
2013-11-08 15:19:09 -05:00
|
|
|
|
2018-01-22 18:31:41 -05:00
|
|
|
func (s *StepSuppressMessages) Run(_ context.Context, state multistep.StateBag) multistep.StepAction {
|
2013-12-24 16:26:44 -05:00
|
|
|
driver := state.Get("driver").(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
|
|
|
|
}
|
|
|
|
|
2013-12-24 16:26:44 -05:00
|
|
|
func (s *StepSuppressMessages) Cleanup(state multistep.StateBag) {}
|