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