builder/amazon/chroot: delete the EBS volume after we're done
This commit is contained in:
parent
e5f0cbe298
commit
3f49f1a6d0
|
@ -63,4 +63,17 @@ func (s *StepCreateVolume) Run(state map[string]interface{}) multistep.StepActio
|
|||
return multistep.ActionContinue
|
||||
}
|
||||
|
||||
func (s *StepCreateVolume) Cleanup(map[string]interface{}) {}
|
||||
func (s *StepCreateVolume) Cleanup(state map[string]interface{}) {
|
||||
if s.volumeId == "" {
|
||||
return
|
||||
}
|
||||
|
||||
ec2conn := state["ec2"].(*ec2.EC2)
|
||||
ui := state["ui"].(packer.Ui)
|
||||
|
||||
ui.Say("Deleting the created EBS volume...")
|
||||
_, err := ec2conn.DeleteVolume(s.volumeId)
|
||||
if err != nil {
|
||||
ui.Error(fmt.Sprintf("Error deleting EBS volume: %s", err))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue