fix: service catalog nil pointer

This commit is contained in:
Qiu Jian
2019-07-02 18:13:15 +08:00
parent ffb22f1d45
commit f7568f9aad
3 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -375,7 +375,7 @@ func (self *SIdentityProvider) CanSync() bool {
func (self *SIdentityProvider) getSyncIntervalSeconds() int {
if self.SyncIntervalSeconds == 0 {
return options.Options.DefaultSyncIntervalSeoncds
return options.Options.DefaultSyncIntervalSeconds
}
return self.SyncIntervalSeconds
}
+1 -1
View File
@@ -34,7 +34,7 @@ type SKeystoneOptions struct {
AutoSyncIntervalSeconds int `help:"frequency to check auto sync tasks" default:"30"`
DefaultSyncIntervalSeoncds int `help:"frequency to do auto sync tasks" default:"900"`
DefaultSyncIntervalSeconds int `help:"frequency to do auto sync tasks" default:"900"`
FetchProjectResourceCountIntervalSeconds int `help:"frequency tp fetch project resource counts" default:"900"`
}
+2 -2
View File
@@ -141,7 +141,7 @@ func (this *ClientSession) GetServiceVersionURL(service, endpointType, apiVersio
}
service = this.getServiceName(service, apiVersion)
url, err := this.token.GetServiceURL(service, this.region, this.zone, endpointType)
if err != nil {
if err != nil && this.client.serviceCatalog != nil {
url, err = this.client.serviceCatalog.GetServiceURL(service, this.region, this.zone, endpointType)
}
if err != nil && service == api.SERVICE_TYPE {
@@ -161,7 +161,7 @@ func (this *ClientSession) GetServiceVersionURLs(service, endpointType, apiVersi
}
service = this.getServiceName(service, apiVersion)
urls, err := this.token.GetServiceURLs(service, this.region, this.zone, endpointType)
if err != nil {
if err != nil && this.client.serviceCatalog != nil {
urls, err = this.client.serviceCatalog.GetServiceURLs(service, this.region, this.zone, endpointType)
}
if err != nil && service == api.SERVICE_TYPE {