Skip to content

Commit

Permalink
ctyun sync host wire fix
Browse files Browse the repository at this point in the history
  • Loading branch information
tangbin committed Jun 4, 2020
1 parent 0d75932 commit f58a930
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions pkg/multicloud/ctyun/region.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ type SRegion struct {
client *SCtyunClient
storageCache *SStoragecache

//
initialled bool

RegionName string
Description string `json:"description"`
ID string `json:"id"`
Expand Down Expand Up @@ -195,24 +198,28 @@ func (self *SRegion) GetGeographicInfo() cloudprovider.SGeographicInfo {

// http://ctyun-api-url/apiproxy/v3/order/getZoneConfig
func (self *SRegion) GetIZones() ([]cloudprovider.ICloudZone, error) {
if self.izones == nil {
if self.izones == nil || self.initialled == false {
var err error
err = self.fetchInfrastructure()
if err != nil {
return nil, err
}

self.initialled = true
}
return self.izones, nil
}

// http://ctyun-api-url/apiproxy/v3/getVpcs
// http://ctyun-api-url/apiproxy/v3/getVpcs
func (self *SRegion) GetIVpcs() ([]cloudprovider.ICloudVpc, error) {
if self.ivpcs == nil {
if self.ivpcs == nil || self.initialled == false {
err := self.fetchInfrastructure()
if err != nil {
return nil, err
}

self.initialled = true
}
return self.ivpcs, nil
}
Expand Down

0 comments on commit f58a930

Please sign in to comment.