mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
minor updates
This commit is contained in:
@@ -182,22 +182,24 @@ func (self *SCloudaccount) ValidateUpdateData(ctx context.Context, userCred mccl
|
||||
data.Set("sync_interval_seconds", jsonutils.NewInt(syncIntervalSecs))
|
||||
}
|
||||
if data.Contains("options") || data.Contains("remove_options") {
|
||||
toRemoveKeys, _ := data.GetArray("remove_options")
|
||||
removes := make([]string, 0)
|
||||
if len(toRemoveKeys) > 0 {
|
||||
for i := range toRemoveKeys {
|
||||
key, _ := toRemoveKeys[i].GetString()
|
||||
removes = append(removes, key)
|
||||
}
|
||||
}
|
||||
var optionsJson *jsonutils.JSONDict
|
||||
if self.Options != nil {
|
||||
toRemoveKeys, _ := data.GetArray("remove_options")
|
||||
removes := make([]string, 0)
|
||||
if len(toRemoveKeys) > 0 {
|
||||
for i := range toRemoveKeys {
|
||||
key, _ := toRemoveKeys[i].GetString()
|
||||
removes = append(removes, key)
|
||||
}
|
||||
}
|
||||
optionsJson = self.Options.CopyExcludes(removes...)
|
||||
} else {
|
||||
optionsJson = jsonutils.NewDict()
|
||||
}
|
||||
toUpdate, _ := data.Get("options")
|
||||
optionsJson.Update(toUpdate)
|
||||
if toUpdate != nil {
|
||||
optionsJson.Update(toUpdate)
|
||||
}
|
||||
data.Set("options", optionsJson)
|
||||
}
|
||||
return self.SEnabledStatusStandaloneResourceBase.ValidateUpdateData(ctx, userCred, query, data)
|
||||
|
||||
Reference in New Issue
Block a user