mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
fix(region): 不能通过华为云用户创建时间判断云账号注册时间
This commit is contained in:
@@ -204,9 +204,8 @@ func (self *SHuaweiClient) fetchRegions() error {
|
||||
return err
|
||||
}
|
||||
|
||||
regionId := strings.Split(project.Name, "_")[0]
|
||||
for _, region := range self.regions {
|
||||
if region.ID == regionId || project.Name == region.ID {
|
||||
if strings.Count(project.Name, region.ID) >= 1 {
|
||||
filtedRegions = append(filtedRegions, region)
|
||||
}
|
||||
if project.Name == region.ID {
|
||||
@@ -331,14 +330,15 @@ func (self *SHuaweiClient) GetSubAccounts() ([]cloudprovider.SSubAccount, error)
|
||||
continue
|
||||
}
|
||||
// https://www.huaweicloud.com/notice/2018/20190618171312411.html
|
||||
expiredAt, _ := timeutils.ParseTimeStr("2020-09-16 00:00:00")
|
||||
if !self.ownerCreateTime.IsZero() && self.ownerCreateTime.After(expiredAt) && strings.ToLower(project.Name) == "cn-north-1" {
|
||||
continue
|
||||
}
|
||||
// expiredAt, _ := timeutils.ParseTimeStr("2020-09-16 00:00:00")
|
||||
// if !self.ownerCreateTime.IsZero() && self.ownerCreateTime.After(expiredAt) && strings.ToLower(project.Name) == "cn-north-1" {
|
||||
// continue
|
||||
// }
|
||||
s := cloudprovider.SSubAccount{
|
||||
Name: fmt.Sprintf("%s-%s", self.cpcfg.Name, project.Name),
|
||||
Account: fmt.Sprintf("%s/%s", self.accessKey, project.ID),
|
||||
HealthStatus: project.GetHealthStatus(),
|
||||
Name: fmt.Sprintf("%s-%s", self.cpcfg.Name, project.Name),
|
||||
Account: fmt.Sprintf("%s/%s", self.accessKey, project.ID),
|
||||
HealthStatus: project.GetHealthStatus(),
|
||||
DefaultProjectId: "0",
|
||||
}
|
||||
|
||||
subAccounts = append(subAccounts, s)
|
||||
|
||||
@@ -73,8 +73,7 @@ func (self *SRegion) getECSClient() (*client.Client, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
regionId := strings.Split(project.Name, "_")[0]
|
||||
if regionId != self.ID && project.Name != self.ID {
|
||||
if !strings.Contains(project.Name, self.ID) {
|
||||
return nil, errors.Errorf("region %s and project %s mismatch", self.ID, project.Name)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user