clean up ip reservations
This commit is contained in:
parent
565b660b19
commit
3ee1aa3ed6
|
@ -54,6 +54,6 @@ func TestValidationsIgnoresOptional(t *testing.T) {
|
|||
delete(tc, "ssh_username")
|
||||
_, err := NewConfig(tc)
|
||||
if err != nil {
|
||||
t.Fatalf("Test shouldn't care if ssh_username is missing: err: %#v", err.Error())
|
||||
t.Fatalf("Shouldn't care if ssh_username is missing: err: %#v", err.Error())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,5 +42,16 @@ func (s *stepCreateIPReservation) Run(_ context.Context, state multistep.StateBa
|
|||
}
|
||||
|
||||
func (s *stepCreateIPReservation) Cleanup(state multistep.StateBag) {
|
||||
// TODO: delete ip reservation
|
||||
ui := state.Get("ui").(packer.Ui)
|
||||
ui.Message("Cleaning up IP reservations...")
|
||||
client := state.Get("client").(*compute.ComputeClient)
|
||||
|
||||
ipResName := state.Get("ipres_name").(string)
|
||||
input := compute.DeleteIPReservationInput{Name: ipResName}
|
||||
ipClient := client.IPReservations()
|
||||
err := ipClient.DeleteIPReservation(&input)
|
||||
if err != nil {
|
||||
fmt.Printf("error deleting IP reservation: %s", err.Error())
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue