mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-10-29 17:58:36 +08:00
Merge pull request #12795 from ioito/hotfix/qx-apsara-tags
fix(region): apsara tags sync for project
This commit is contained in:
@@ -254,7 +254,7 @@ func (self *SExternalProject) SyncWithCloudProject(ctx context.Context, userCred
|
||||
|
||||
tags, _ := ext.GetTags()
|
||||
if len(tags) > 0 {
|
||||
identity.Projects.PerformAction(s, self.ProjectId, "user-metadata", jsonutils.Marshal(tags))
|
||||
identity.Projects.PerformAction(s, self.ProjectId, "set-user-metadata", jsonutils.Marshal(tags))
|
||||
}
|
||||
syncMetadata(ctx, userCred, self, ext)
|
||||
db.OpsLog.LogSyncUpdate(self, diff, userCred)
|
||||
@@ -351,7 +351,7 @@ func (manager *SExternalProjectManager) newFromCloudProject(ctx context.Context,
|
||||
tags, _ := extProject.GetTags()
|
||||
if len(tags) > 0 {
|
||||
s := auth.GetAdminSession(ctx, consts.GetRegion(), "v1")
|
||||
identity.Projects.PerformAction(s, project.ProjectId, "user-metadata", jsonutils.Marshal(tags))
|
||||
identity.Projects.PerformAction(s, project.ProjectId, "set-user-metadata", jsonutils.Marshal(tags))
|
||||
}
|
||||
|
||||
syncMetadata(ctx, userCred, &project, extProject)
|
||||
|
||||
@@ -176,11 +176,7 @@ func (self *SProject) SetTags(tags map[string]string, replace bool) error {
|
||||
func (self *SProject) GetTags() (map[string]string, error) {
|
||||
ret := map[string]string{}
|
||||
for i, key := range self.Tags {
|
||||
for j, value := range self.Tags {
|
||||
if j-i == 1 {
|
||||
ret[key] = value
|
||||
}
|
||||
}
|
||||
ret[fmt.Sprintf("L%d", i+1)] = key
|
||||
}
|
||||
return ret, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user