2013-09-02 23:23:52 -04:00
|
|
|
package qemu
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"os"
|
|
|
|
)
|
|
|
|
|
2013-09-03 19:13:05 -04:00
|
|
|
// Artifact is the result of running the Qemu builder, namely a set
|
2013-09-02 23:23:52 -04:00
|
|
|
// of files associated with the resulting machine.
|
|
|
|
type Artifact struct {
|
2014-10-28 11:43:19 -04:00
|
|
|
dir string
|
|
|
|
f []string
|
2014-01-05 20:02:30 -05:00
|
|
|
state map[string]interface{}
|
2013-09-02 23:23:52 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
func (*Artifact) BuilderId() string {
|
|
|
|
return BuilderId
|
|
|
|
}
|
|
|
|
|
|
|
|
func (a *Artifact) Files() []string {
|
|
|
|
return a.f
|
|
|
|
}
|
|
|
|
|
|
|
|
func (*Artifact) Id() string {
|
|
|
|
return "VM"
|
|
|
|
}
|
|
|
|
|
|
|
|
func (a *Artifact) String() string {
|
|
|
|
return fmt.Sprintf("VM files in directory: %s", a.dir)
|
|
|
|
}
|
|
|
|
|
2014-01-19 13:32:44 -05:00
|
|
|
func (a *Artifact) State(name string) interface{} {
|
2014-01-05 20:02:30 -05:00
|
|
|
return a.state[name]
|
2014-01-19 13:32:44 -05:00
|
|
|
}
|
|
|
|
|
2013-09-02 23:23:52 -04:00
|
|
|
func (a *Artifact) Destroy() error {
|
|
|
|
return os.RemoveAll(a.dir)
|
|
|
|
}
|