handle VM clone errors

do not try to cleanup failed VM, it it's not created
This commit is contained in:
Michael Kuzmin 2017-08-24 21:54:01 +03:00
parent e8d8fd6205
commit 1046b5ef09
1 changed files with 6 additions and 1 deletions

View File

@ -74,7 +74,12 @@ func (s *StepCloneVM) Cleanup(state multistep.StateBag) {
}
ui := state.Get("ui").(packer.Ui)
vm := state.Get("vm").(*driver.VirtualMachine)
st := state.Get("vm")
if st == nil {
return
}
vm := st.(*driver.VirtualMachine)
ui.Say("Destroying VM...")