use 404 error type

This commit is contained in:
Matthew Hooker 2016-12-13 14:20:39 -08:00
parent 01e3e7f7a3
commit 6a6e735d16
No known key found for this signature in database
GPG Key ID: 7B5F933D9CE8C6A1
1 changed files with 3 additions and 5 deletions

View File

@ -38,14 +38,12 @@ func ServerStateRefreshFunc(
return func() (interface{}, string, int, error) { return func() (interface{}, string, int, error) {
serverNew, err := servers.Get(client, s.ID).Extract() serverNew, err := servers.Get(client, s.ID).Extract()
if err != nil { if err != nil {
errCode, ok := err.(*gophercloud.ErrUnexpectedResponseCode) if _, ok := err.(gophercloud.ErrDefault404); ok {
if ok && errCode.Actual == 404 {
log.Printf("[INFO] 404 on ServerStateRefresh, returning DELETED") log.Printf("[INFO] 404 on ServerStateRefresh, returning DELETED")
return nil, "DELETED", 0, nil return nil, "DELETED", 0, nil
} else {
log.Printf("[ERROR] Error on ServerStateRefresh: %s", err)
return nil, "", 0, err
} }
log.Printf("[ERROR] Error on ServerStateRefresh: %s", err)
return nil, "", 0, err
} }
return serverNew, serverNew.Status, serverNew.Progress, nil return serverNew, serverNew.Status, serverNew.Progress, nil