fix bugs in cleanup

This commit is contained in:
Megan Marsh 2018-01-19 16:13:36 -08:00 committed by Matthew Hooker
parent f6c60aac78
commit 89159f3a87
No known key found for this signature in database
GPG Key ID: 7B5F933D9CE8C6A1
1 changed files with 3 additions and 2 deletions

View File

@ -95,9 +95,10 @@ func (s *stepCreateInstance) Cleanup(state multistep.StateBag) {
// terminate instance
ui := state.Get("ui").(packer.Ui)
client := state.Get("client").(*compute.ComputeClient)
config := state.Get("config").(*Config)
imID := state.Get("instance_id").(string)
ui.Say(fmt.Sprintf("Terminating instance (%s)...", id))
ui.Say(fmt.Sprintf("Terminating instance (%s)...", imID))
instanceClient := client.Instances()
// Instances Input
@ -106,7 +107,7 @@ func (s *stepCreateInstance) Cleanup(state multistep.StateBag) {
ID: imID,
}
instanceInfo, err := instanceClient.DeleteInstance(input)
err := instanceClient.DeleteInstance(input)
if err != nil {
err = fmt.Errorf("Problem destroying instance: %s", err)
ui.Error(err.Error())