github.com/ddnomad/packer@v1.3.2/provisioner/shell-local/provisioner.go (about)

     1  package shell
     2  
     3  import (
     4  	sl "github.com/hashicorp/packer/common/shell-local"
     5  	"github.com/hashicorp/packer/packer"
     6  )
     7  
     8  type Provisioner struct {
     9  	config sl.Config
    10  }
    11  
    12  func (p *Provisioner) Prepare(raws ...interface{}) error {
    13  	err := sl.Decode(&p.config, raws...)
    14  	if err != nil {
    15  		return err
    16  	}
    17  
    18  	err = sl.Validate(&p.config)
    19  	if err != nil {
    20  		return err
    21  	}
    22  
    23  	return nil
    24  }
    25  
    26  func (p *Provisioner) Provision(ui packer.Ui, _ packer.Communicator) error {
    27  	_, retErr := sl.Run(ui, &p.config)
    28  	if retErr != nil {
    29  		return retErr
    30  	}
    31  
    32  	return nil
    33  }
    34  
    35  func (p *Provisioner) Cancel() {
    36  	// Just do nothing. When the process ends, so will our provisioner
    37  }