2013-06-27 19:21:03 -04:00
|
|
|
package vagrant
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"path/filepath"
|
2018-01-22 20:21:10 -05:00
|
|
|
|
2020-12-17 16:29:25 -05:00
|
|
|
packersdk "github.com/hashicorp/packer-plugin-sdk/packer"
|
2013-06-27 19:21:03 -04:00
|
|
|
)
|
|
|
|
|
2013-12-19 16:44:18 -05:00
|
|
|
type VMwareProvider struct{}
|
2013-08-15 15:09:22 -04:00
|
|
|
|
2014-02-21 23:02:40 -05:00
|
|
|
func (p *VMwareProvider) KeepInputArtifact() bool {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
2020-11-19 15:17:11 -05:00
|
|
|
func (p *VMwareProvider) Process(ui packersdk.Ui, artifact packersdk.Artifact, dir string) (vagrantfile string, metadata map[string]interface{}, err error) {
|
2013-12-19 16:44:18 -05:00
|
|
|
// Create the metadata
|
|
|
|
metadata = map[string]interface{}{"provider": "vmware_desktop"}
|
2013-06-27 19:21:03 -04:00
|
|
|
|
|
|
|
// Copy all of the original contents into the temporary directory
|
|
|
|
for _, path := range artifact.Files() {
|
|
|
|
ui.Message(fmt.Sprintf("Copying: %s", path))
|
|
|
|
|
2013-07-07 20:44:13 -04:00
|
|
|
dstPath := filepath.Join(dir, filepath.Base(path))
|
2013-12-19 16:44:18 -05:00
|
|
|
if err = CopyContents(dstPath, path); err != nil {
|
|
|
|
return
|
2013-06-27 19:21:03 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-12-19 16:44:18 -05:00
|
|
|
return
|
2013-06-27 19:21:03 -04:00
|
|
|
}
|