failure fast if not 200 when authenticating
Change-Id: Ibe1c38f632d1f0155830f00354de2135ee5aceb6
This commit is contained in:
parent
452642dade
commit
16ac1f84b2
@ -18,6 +18,7 @@ package openstack
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"strings"
|
||||
"time"
|
||||
@ -91,6 +92,11 @@ func DoAuthRequest(authopts AuthOpts) (AuthRef, error) {
|
||||
if err != nil {
|
||||
return nil, errors.New("error reading response body")
|
||||
}
|
||||
|
||||
if resp.StatusCode != 200 {
|
||||
return nil, fmt.Errorf("auth error: %s", rbody)
|
||||
}
|
||||
|
||||
if err = json.Unmarshal(rbody, &auth); err != nil {
|
||||
return nil, errors.New("error unmarshalling response body")
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user