Skip to content
This repository has been archived by the owner on Jan 17, 2025. It is now read-only.

Commit

Permalink
Fix error handling for port deletion
Browse files Browse the repository at this point in the history
Signed-off-by: Dimitrios Karagiannis <[email protected]>
  • Loading branch information
alkar committed Oct 9, 2019
1 parent 70fe958 commit 786598a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions megaport/resource_megaport_port.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,12 @@ func resourceMegaportPortDelete(d *schema.ResourceData, m interface{}) error {
log.Printf("!!! DELETE")
cfg := m.(*Config)
err := cfg.Client.Port.Delete(d.Id())
if err != api.ErrNotFound {
if err != nil && err != api.ErrNotFound {
return err
}
log.Printf("resourceMegaportPortDelete: resource not found, deleting anyway")
if err == api.ErrNotFound {
log.Printf("resourceMegaportPortDelete: resource not found, deleting anyway")
}
return nil
}

Expand Down

0 comments on commit 786598a

Please sign in to comment.