2014-04-26 12:22:10 -04:00
|
|
|
package compress
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"os"
|
|
|
|
)
|
|
|
|
|
2015-06-10 14:04:24 -07:00
|
|
|
const BuilderId = "packer.post-processor.compress"
|
2014-04-26 12:22:10 -04:00
|
|
|
|
|
|
|
type Artifact struct {
|
2017-03-28 18:02:51 -07:00
|
|
|
Path string
|
2014-04-26 12:22:10 -04:00
|
|
|
}
|
|
|
|
|
2015-06-10 12:30:18 -07:00
|
|
|
func (a *Artifact) BuilderId() string {
|
2014-04-26 12:22:10 -04:00
|
|
|
return BuilderId
|
|
|
|
}
|
|
|
|
|
2015-06-12 17:25:09 -07:00
|
|
|
func (*Artifact) Id() string {
|
|
|
|
return ""
|
2014-04-26 12:22:10 -04:00
|
|
|
}
|
|
|
|
|
2015-06-12 17:25:09 -07:00
|
|
|
func (a *Artifact) Files() []string {
|
2015-06-18 05:13:48 -07:00
|
|
|
return []string{a.Path}
|
2014-04-26 12:22:10 -04:00
|
|
|
}
|
|
|
|
|
2015-06-10 12:30:18 -07:00
|
|
|
func (a *Artifact) String() string {
|
2016-05-08 14:11:54 +03:00
|
|
|
return fmt.Sprintf("compressed artifacts in: %s", a.Path)
|
2014-04-26 12:22:10 -04:00
|
|
|
}
|
|
|
|
|
2014-01-19 18:32:44 +00:00
|
|
|
func (*Artifact) State(name string) interface{} {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2015-06-10 12:30:18 -07:00
|
|
|
func (a *Artifact) Destroy() error {
|
2015-06-12 17:25:09 -07:00
|
|
|
return os.Remove(a.Path)
|
2014-04-26 12:22:10 -04:00
|
|
|
}
|