forked from hashicorp/packer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
lxc.go
34 lines (26 loc) · 732 Bytes
/
lxc.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package vagrant
import (
"fmt"
"path/filepath"
"github.com/hashicorp/packer/packer"
)
type LXCProvider struct{}
func (p *LXCProvider) KeepInputArtifact() bool {
return false
}
func (p *LXCProvider) 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": "lxc",
"version": "1.0.0",
}
// 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
}