修正:client newsession时候,如果token没有service catalog,导致fatal

error
This commit is contained in:
Qiu Jian
2018-08-24 11:47:46 +08:00
parent 42ca6924d8
commit 644e19e23f
+5 -3
View File
@@ -311,10 +311,12 @@ func (this *Client) SetProject(tenantId, tenantName string, token TokenCredentia
func (this *Client) NewSession(region, zone, endpointType string, token TokenCredential, apiVersion string) *ClientSession {
cata := token.GetServiceCatalog()
if cata == nil {
log.Fatalf("Missing service catalog in token")
if this.serviceCatalog == nil {
if cata == nil {
log.Fatalf("Missing service catalog in token")
}
this.serviceCatalog = cata
}
this.serviceCatalog = cata
return &ClientSession{client: this, region: region, zone: zone,
endpointType: endpointType, token: token,
apiVersion: apiVersion,