fix(region): skip sync resource when account created

This commit is contained in:
ioito
2023-07-17 17:47:27 +08:00
parent bda6019cb0
commit df81a7b18e
+12 -2
View File
@@ -29,6 +29,7 @@ import (
"yunion.io/x/jsonutils"
"yunion.io/x/log"
"yunion.io/x/pkg/errors"
"yunion.io/x/pkg/gotypes"
"yunion.io/x/pkg/tristate"
"yunion.io/x/pkg/util/compare"
"yunion.io/x/pkg/util/httputils"
@@ -836,9 +837,18 @@ func (self *SCloudaccount) StartSyncCloudAccountInfoTask(ctx context.Context, us
if data != nil {
params.Update(data)
}
if syncRange != nil {
params.Add(jsonutils.Marshal(syncRange), "sync_range")
if gotypes.IsNil(syncRange) {
syncRange = &SSyncRange{}
syncRange.FullSync = true
syncRange.DeepSync = true
}
syncRange.SkipSyncResources = []string{}
if self.SkipSyncResources != nil {
for _, res := range *self.SkipSyncResources {
syncRange.SkipSyncResources = append(syncRange.SkipSyncResources, res)
}
}
params.Add(jsonutils.Marshal(syncRange), "sync_range")
task, err := taskman.TaskManager.NewTask(ctx, "CloudAccountSyncInfoTask", self, userCred, params, "", "", nil)
if err != nil {