post-processor/vagrant-cloud: in error, don't delete version [GH-2014]
This commit is contained in:
parent
58b430d7ef
commit
e728c09301
|
@ -55,31 +55,4 @@ func (s *stepCreateVersion) Run(state multistep.StateBag) multistep.StepAction {
|
|||
return multistep.ActionContinue
|
||||
}
|
||||
|
||||
func (s *stepCreateVersion) Cleanup(state multistep.StateBag) {
|
||||
client := state.Get("client").(*VagrantCloudClient)
|
||||
ui := state.Get("ui").(packer.Ui)
|
||||
box := state.Get("box").(*Box)
|
||||
version := state.Get("version").(*Version)
|
||||
|
||||
_, cancelled := state.GetOk(multistep.StateCancelled)
|
||||
_, halted := state.GetOk(multistep.StateHalted)
|
||||
|
||||
// Return if we didn't cancel or halt, and thus need
|
||||
// no cleanup
|
||||
if !cancelled && !halted {
|
||||
return
|
||||
}
|
||||
|
||||
path := fmt.Sprintf("box/%s/version/%v", box.Tag, version.Version)
|
||||
|
||||
ui.Say("Cleaning up version")
|
||||
ui.Message(fmt.Sprintf("Deleting version: %s", version.Version))
|
||||
|
||||
// No need for resp from the cleanup DELETE
|
||||
_, err := client.Delete(path)
|
||||
|
||||
if err != nil {
|
||||
ui.Error(fmt.Sprintf("Error destroying version: %s", err))
|
||||
}
|
||||
|
||||
}
|
||||
func (s *stepCreateVersion) Cleanup(state multistep.StateBag) {}
|
||||
|
|
Loading…
Reference in New Issue