github.com/alouche/packer@v0.3.7/builder/vmware/step_prepare_tools.go (about)

     1  package vmware
     2  
     3  import (
     4  	"fmt"
     5  	"github.com/mitchellh/multistep"
     6  	"os"
     7  )
     8  
     9  type stepPrepareTools struct{}
    10  
    11  func (*stepPrepareTools) Run(state multistep.StateBag) multistep.StepAction {
    12  	config := state.Get("config").(*config)
    13  	driver := state.Get("driver").(Driver)
    14  
    15  	if config.ToolsUploadFlavor == "" {
    16  		return multistep.ActionContinue
    17  	}
    18  
    19  	path := driver.ToolsIsoPath(config.ToolsUploadFlavor)
    20  	if _, err := os.Stat(path); err != nil {
    21  		state.Put("error", fmt.Errorf(
    22  			"Couldn't find VMware tools for '%s'! VMware often downloads these\n"+
    23  				"tools on-demand. However, to do this, you need to create a fake VM\n"+
    24  				"of the proper type then click the 'install tools' option in the\n"+
    25  				"VMware GUI.", config.ToolsUploadFlavor))
    26  		return multistep.ActionHalt
    27  	}
    28  
    29  	state.Put("tools_upload_source", path)
    30  	return multistep.ActionContinue
    31  }
    32  
    33  func (*stepPrepareTools) Cleanup(multistep.StateBag) {}