IsNotFound should check ErrDefault404 and ErrUnexpectedResponseCode

Related to: #60658 #60976
Refer to:
  https://github.com/gophercloud/gophercloud/pull/103
This commit is contained in:
FengyunPan2 2018-03-10 10:57:37 +08:00
parent 9ad5ea2d61
commit 0da1660653

View File

@ -605,8 +605,17 @@ func (os *OpenStack) LoadBalancer() (cloudprovider.LoadBalancer, bool) {
}
func isNotFound(err error) bool {
e, ok := err.(*gophercloud.ErrUnexpectedResponseCode)
return ok && e.Actual == http.StatusNotFound
if _, ok := err.(gophercloud.ErrDefault404); ok {
return true
}
if errCode, ok := err.(gophercloud.ErrUnexpectedResponseCode); ok {
if errCode.Actual == http.StatusNotFound {
return true
}
}
return false
}
// Zones indicates that we support zones