packer-cn/provisioner/shell-local/provisioner.go

37 lines
648 B
Go
Raw Normal View History

2015-06-19 18:06:06 -04:00
package shell
import (
"context"
sl "github.com/hashicorp/packer/common/shell-local"
2017-04-04 16:39:01 -04:00
"github.com/hashicorp/packer/packer"
2015-06-19 18:06:06 -04:00
)
type Provisioner struct {
config sl.Config
2015-06-19 18:06:06 -04:00
}
func (p *Provisioner) Prepare(raws ...interface{}) error {
err := sl.Decode(&p.config, raws...)
2015-06-19 18:06:06 -04:00
if err != nil {
return err
}
err = sl.Validate(&p.config)
if err != nil {
return err
}
return nil
}
func (p *Provisioner) Provision(ctx context.Context, ui packer.Ui, _ packer.Communicator) error {
_, retErr := sl.Run(ctx, ui, &p.config)
2015-06-19 18:06:06 -04:00
2019-06-12 16:18:57 -04:00
return retErr
2015-06-19 18:06:06 -04:00
}
func (p *Provisioner) Cancel() {
// Just do nothing. When the process ends, so will our provisioner
}