rename option to error-cleanup-privisoner, which I think is clearer

This commit is contained in:
Megan Marsh 2019-09-25 13:43:29 -07:00
parent 0683bc409b
commit 59efa0faee
3 changed files with 5 additions and 5 deletions

View File

@ -11,7 +11,7 @@
"inline": ["exit 2"]
}
],
"on-error-script": {
"error-cleanup-provisioner": {
"type": "shell-local",
"inline": ["echo 'rubber ducky'> ducky.txt"]
}

View File

@ -81,9 +81,9 @@ func (s *StepProvision) Run(ctx context.Context, state multistep.StateBag) multi
}
func (s *StepProvision) Cleanup(state multistep.StateBag) {
// We have a "final" provisioner that gets defined by "on-error-script"
// We have a "final" provisioner that gets defined by "error-cleanup-provisioner"
// which we only call if there's an error during the provision run and
// the "on-error-script" is defined.
// the "error-cleanup-provisioner" is defined.
if _, ok := state.GetOk("error"); ok {
s.runWithHook(context.Background(), state, packer.HookCleanupProvision)
}

View File

@ -29,7 +29,7 @@ type rawTemplate struct {
Push map[string]interface{} `json:"push,omitempty"`
PostProcessors []interface{} `mapstructure:"post-processors" json:"post-processors,omitempty"`
Provisioners []interface{} `json:"provisioners,omitempty"`
CleanupProvisioner interface{} `mapstructure:"on-error-script" json:"on-error-script,omitempty"`
CleanupProvisioner interface{} `mapstructure:"error-cleanup-provisioner" json:"error-cleanup-provisioner,omitempty"`
Variables map[string]interface{} `json:"variables,omitempty"`
SensitiveVariables []string `mapstructure:"sensitive-variables" json:"sensitive-variables,omitempty"`
@ -244,7 +244,7 @@ func (r *rawTemplate) Template() (*Template, error) {
result.Provisioners = append(result.Provisioners, &p)
}
// Gather the on-error-script
// Gather the error-cleanup-provisioner
if r.CleanupProvisioner != nil {
var p Provisioner
if err := r.decoder(&p, nil).Decode(r.CleanupProvisioner); err != nil {