Merge pull request #1284 from MSOpenTech/master
post-processor/vagrant: hyper-v
This commit is contained in:
commit
1cf6948089
|
@ -0,0 +1,30 @@
|
|||
package vagrant
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/mitchellh/packer/packer"
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
type HypervProvider struct{}
|
||||
|
||||
func (p *HypervProvider) KeepInputArtifact() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (p *HypervProvider) 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": "hyperv"}
|
||||
|
||||
// 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))
|
||||
if err = CopyContents(dstPath, path); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
|
@ -22,6 +22,7 @@ var builtins = map[string]string{
|
|||
"mitchellh.vmware": "vmware",
|
||||
"pearkes.digitalocean": "digitalocean",
|
||||
"packer.parallels": "parallels",
|
||||
"MSOpenTech.hyperv": "hyperv",
|
||||
}
|
||||
|
||||
type Config struct {
|
||||
|
@ -220,6 +221,8 @@ func providerForName(name string) Provider {
|
|||
return new(VMwareProvider)
|
||||
case "parallels":
|
||||
return new(ParallelsProvider)
|
||||
case "hyperv":
|
||||
return new(HypervProvider)
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue