rename option to error-cleanup-privisoner, which I think is clearer
This commit is contained in:
parent
0683bc409b
commit
59efa0faee
|
@ -11,7 +11,7 @@
|
|||
"inline": ["exit 2"]
|
||||
}
|
||||
],
|
||||
"on-error-script": {
|
||||
"error-cleanup-provisioner": {
|
||||
"type": "shell-local",
|
||||
"inline": ["echo 'rubber ducky'> ducky.txt"]
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue