2017-02-03 15:56:13 +02:00
|
|
|
package common
|
2013-06-06 15:12:54 -07:00
|
|
|
|
2013-06-18 16:01:14 -07:00
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
)
|
2013-06-06 15:12:54 -07:00
|
|
|
|
|
|
|
// Artifact is the result of running the VMware builder, namely a set
|
|
|
|
// of files associated with the resulting machine.
|
2017-02-03 15:56:13 +02:00
|
|
|
type RemoteArtifact struct {
|
2013-11-18 16:10:55 -08:00
|
|
|
builderId string
|
2017-07-28 03:59:11 +03:00
|
|
|
id string
|
2013-12-25 11:27:53 -07:00
|
|
|
dir OutputDir
|
2013-11-18 16:10:55 -08:00
|
|
|
f []string
|
2017-11-08 15:57:34 -03:00
|
|
|
config map[string]string
|
2013-06-06 15:12:54 -07:00
|
|
|
}
|
|
|
|
|
2017-02-03 15:56:13 +02:00
|
|
|
func (a *RemoteArtifact) BuilderId() string {
|
2013-11-18 16:10:55 -08:00
|
|
|
return a.builderId
|
2013-06-06 15:12:54 -07:00
|
|
|
}
|
|
|
|
|
2017-02-03 15:56:13 +02:00
|
|
|
func (a *RemoteArtifact) Files() []string {
|
2013-06-06 15:12:54 -07:00
|
|
|
return a.f
|
|
|
|
}
|
|
|
|
|
2018-10-25 14:17:35 -07:00
|
|
|
func (a *RemoteArtifact) Id() string {
|
2017-07-28 03:59:11 +03:00
|
|
|
return a.id
|
2013-06-06 15:12:54 -07:00
|
|
|
}
|
|
|
|
|
2017-02-03 15:56:13 +02:00
|
|
|
func (a *RemoteArtifact) String() string {
|
2013-06-06 15:12:54 -07:00
|
|
|
return fmt.Sprintf("VM files in directory: %s", a.dir)
|
|
|
|
}
|
2013-06-18 16:01:14 -07:00
|
|
|
|
2017-02-03 15:56:13 +02:00
|
|
|
func (a *RemoteArtifact) State(name string) interface{} {
|
2017-11-08 15:57:34 -03:00
|
|
|
return a.config[name]
|
2014-01-19 18:32:44 +00:00
|
|
|
}
|
|
|
|
|
2017-02-03 15:56:13 +02:00
|
|
|
func (a *RemoteArtifact) Destroy() error {
|
2013-12-25 11:27:53 -07:00
|
|
|
return a.dir.RemoveAll()
|
2013-06-18 16:01:14 -07:00
|
|
|
}
|