packer-cn/post-processor/shell-local/post-processor.go

37 lines
747 B
Go
Raw Normal View History

package shell_local
import (
sl "github.com/hashicorp/packer/common/shell-local"
2017-04-04 16:39:01 -04:00
"github.com/hashicorp/packer/packer"
)
type PostProcessor struct {
config sl.Config
}
type ExecuteCommandTemplate struct {
Vars string
Script string
}
func (p *PostProcessor) Configure(raws ...interface{}) error {
2018-02-28 17:35:42 -05:00
err := sl.Decode(&p.config, raws...)
if err != nil {
return err
}
return sl.Validate(&p.config)
}
func (p *PostProcessor) PostProcess(ui packer.Ui, artifact packer.Artifact) (packer.Artifact, bool, error) {
// this particular post-processor doesn't do anything with the artifact
// except to return it.
retBool, retErr := sl.Run(ui, &p.config)
if !retBool {
return nil, retBool, retErr
}
return artifact, retBool, retErr
}