packer-cn/post-processor/vagrant/vmware.go

32 lines
723 B
Go
Raw Normal View History

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