provider/openstack: gophercloud migration: router interface error response

This commit is contained in:
Joe Topjian 2016-09-05 04:07:25 +00:00
parent 8f21117fb7
commit 8371d20cf0

View File

@ -146,7 +146,7 @@ func waitForRouterInterfaceDelete(networkingClient *gophercloud.ServiceClient, d
routerId := d.Get("router_id").(string) routerId := d.Get("router_id").(string)
routerInterfaceId := d.Id() routerInterfaceId := d.Id()
log.Printf("[DEBUG] Attempting to delete OpenStack Router Interface %s.\n", routerInterfaceId) log.Printf("[DEBUG] Attempting to delete OpenStack Router Interface %s.", routerInterfaceId)
removeOpts := routers.RemoveInterfaceOpts{ removeOpts := routers.RemoveInterfaceOpts{
SubnetID: d.Get("subnet_id").(string), SubnetID: d.Get("subnet_id").(string),
@ -168,10 +168,18 @@ func waitForRouterInterfaceDelete(networkingClient *gophercloud.ServiceClient, d
log.Printf("[DEBUG] Successfully deleted OpenStack Router Interface %s", routerInterfaceId) log.Printf("[DEBUG] Successfully deleted OpenStack Router Interface %s", routerInterfaceId)
return r, "DELETED", nil return r, "DELETED", nil
} }
if errCode, ok := err.(gophercloud.ErrUnexpectedResponseCode); ok {
if errCode.Actual == 409 {
log.Printf("[DEBUG] Received a 409 response. Interface still in use.")
return r, "ACTIVE", nil
}
}
return r, "ACTIVE", err return r, "ACTIVE", err
} }
log.Printf("[DEBUG] OpenStack Router Interface %s still active.\n", routerInterfaceId) log.Printf("[DEBUG] OpenStack Router Interface %s still active.", routerInterfaceId)
return r, "ACTIVE", nil return r, "ACTIVE", nil
} }
} }