failure fast if not 200 when authenticating
Change-Id: Ibe1c38f632d1f0155830f00354de2135ee5aceb6
This commit is contained in:
		| @@ -18,6 +18,7 @@ package openstack | |||||||
| import ( | import ( | ||||||
| 	"encoding/json" | 	"encoding/json" | ||||||
| 	"errors" | 	"errors" | ||||||
|  | 	"fmt" | ||||||
| 	"io/ioutil" | 	"io/ioutil" | ||||||
| 	"strings" | 	"strings" | ||||||
| 	"time" | 	"time" | ||||||
| @@ -91,6 +92,11 @@ func DoAuthRequest(authopts AuthOpts) (AuthRef, error) { | |||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		return nil, errors.New("error reading response body") | 		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 { | 	if err = json.Unmarshal(rbody, &auth); err != nil { | ||||||
| 		return nil, errors.New("error unmarshalling response body") | 		return nil, errors.New("error unmarshalling response body") | ||||||
| 	} | 	} | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 arkxu
					arkxu