packer-cn/builder/lxd/artifact.go

39 lines
615 B
Go
Raw Normal View History

2016-05-26 23:21:55 -04:00
package lxd
import (
"fmt"
)
type Artifact struct {
2016-05-30 21:13:09 -04:00
id string
// StateData should store data such as GeneratedData
// to be shared with post-processors
StateData map[string]interface{}
2016-05-26 23:21:55 -04:00
}
func (*Artifact) BuilderId() string {
return BuilderId
}
func (a *Artifact) Files() []string {
2016-05-30 21:13:09 -04:00
return nil
2016-05-26 23:21:55 -04:00
}
2016-05-30 21:13:09 -04:00
func (a *Artifact) Id() string {
return a.id
2016-05-26 23:21:55 -04:00
}
func (a *Artifact) String() string {
2016-05-30 21:13:09 -04:00
return fmt.Sprintf("image: %s", a.id)
2016-05-26 23:21:55 -04:00
}
func (a *Artifact) State(name string) interface{} {
return a.StateData[name]
2016-05-26 23:21:55 -04:00
}
func (a *Artifact) Destroy() error {
2016-08-06 23:47:52 -04:00
_, err := LXDCommand("image", "delete", a.id)
return err
2016-05-26 23:21:55 -04:00
}