|
|
|
|
@ -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) {}
|
|
|
|
|
|