mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
fix: organization sync panic on nil pointer of weight (#19486)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
This commit is contained in:
@@ -31,4 +31,5 @@ func init() {
|
||||
orgCmd.Delete(&identity_options.OrganizationIdOptions{})
|
||||
orgCmd.Perform("add-level", &identity_options.OrganizationAddLevelOptions{})
|
||||
orgCmd.Perform("add-node", &identity_options.OrganizationAddNodeOptions{})
|
||||
orgCmd.Perform("clean", &identity_options.OrganizationIdOptions{})
|
||||
}
|
||||
|
||||
@@ -205,3 +205,6 @@ type SOrganizationNodeDetails struct {
|
||||
|
||||
Type TOrgType `json:"type"`
|
||||
}
|
||||
|
||||
type OrganizationPerformCleanInput struct {
|
||||
}
|
||||
|
||||
@@ -117,6 +117,10 @@ func (manager *SOrganizationNodeManager) ensureNode(ctx context.Context, orgId s
|
||||
return nil, errors.Wrap(err, "FetchById")
|
||||
}
|
||||
// not exist
|
||||
if weight == nil {
|
||||
one := 1
|
||||
weight = &one
|
||||
}
|
||||
} else {
|
||||
// exist
|
||||
if weight == nil {
|
||||
|
||||
@@ -661,3 +661,16 @@ func (org *SOrganization) getProjectOrganization(tags map[string]string) (*api.S
|
||||
}
|
||||
return &ret, nil
|
||||
}
|
||||
|
||||
func (org *SOrganization) PerformClean(
|
||||
ctx context.Context,
|
||||
userCred mcclient.TokenCredential,
|
||||
query jsonutils.JSONObject,
|
||||
input api.OrganizationPerformCleanInput,
|
||||
) (jsonutils.JSONObject, error) {
|
||||
err := org.removeAll(ctx, userCred)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "removeAll")
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user