From 1046b5ef0983cb01cd15c9155e33a219a6c78f72 Mon Sep 17 00:00:00 2001 From: Michael Kuzmin Date: Thu, 24 Aug 2017 21:54:01 +0300 Subject: [PATCH] handle VM clone errors do not try to cleanup failed VM, it it's not created --- step_clone.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/step_clone.go b/step_clone.go index cd27ace68..0c4543ff6 100644 --- a/step_clone.go +++ b/step_clone.go @@ -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...")