mirror of https://github.com/kubernetes/kops.git
fix tests
This commit is contained in:
parent
c7e0585e3a
commit
508a590116
|
@ -74,9 +74,6 @@ const (
|
|||
ResourceTypeSubnet = "subnets"
|
||||
)
|
||||
|
||||
// ErrNotFound is used to inform that the object is not found
|
||||
var ErrNotFound = "Resource not found"
|
||||
|
||||
// readBackoff is the backoff strategy for openstack read retries.
|
||||
var readBackoff = wait.Backoff{
|
||||
Duration: time.Second,
|
||||
|
@ -793,6 +790,10 @@ func isNotFound(err error) bool {
|
|||
return true
|
||||
}
|
||||
|
||||
if _, ok := err.(gophercloud.ErrResourceNotFound); ok {
|
||||
return true
|
||||
}
|
||||
|
||||
if errCode, ok := err.(gophercloud.ErrUnexpectedResponseCode); ok {
|
||||
if errCode.Actual == http.StatusNotFound {
|
||||
return true
|
||||
|
|
|
@ -33,7 +33,7 @@ func getKeypair(c OpenstackCloud, name string) (*keypairs.KeyPair, error) {
|
|||
done, err := vfs.RetryWithBackoff(readBackoff, func() (bool, error) {
|
||||
rs, err := keypairs.Get(c.ComputeClient(), name, nil).Extract()
|
||||
if err != nil {
|
||||
if err.Error() == ErrNotFound {
|
||||
if isNotFound(err) {
|
||||
return true, nil
|
||||
}
|
||||
return false, fmt.Errorf("error listing keypair: %v", err)
|
||||
|
|
Loading…
Reference in New Issue