diff --git a/pkg/compute/models/loadbalancercertificates.go b/pkg/compute/models/loadbalancercertificates.go index edb3ad0e36..959e907fed 100644 --- a/pkg/compute/models/loadbalancercertificates.go +++ b/pkg/compute/models/loadbalancercertificates.go @@ -104,6 +104,10 @@ func (lbcert *SLoadbalancerCertificate) ValidateUpdateData(ctx context.Context, updateData.Set("name", jsonutils.NewString(name)) } + if desc, err := data.GetString("description"); err == nil { + updateData.Set("description", jsonutils.NewString(desc)) + } + if _, err := lbcert.SVirtualResourceBase.ValidateUpdateData(ctx, userCred, query, updateData); err != nil { return nil, err } diff --git a/pkg/compute/tasks/eip_associate_task.go b/pkg/compute/tasks/eip_associate_task.go index ac0b00d4ad..a85972c194 100644 --- a/pkg/compute/tasks/eip_associate_task.go +++ b/pkg/compute/tasks/eip_associate_task.go @@ -67,6 +67,7 @@ func (self *EipAssociateTask) OnInit(ctx context.Context, obj db.IStandaloneMode if err := driver.RequestAssociateEip(ctx, self.UserCred, server, eip, self); err != nil { self.TaskFail(ctx, eip, err.Error(), server) + return } server.StartSyncstatus(ctx, self.UserCred, "") diff --git a/pkg/mcclient/modules/mod_projects.go b/pkg/mcclient/modules/mod_projects.go index 2139b9f010..5100720ce3 100644 --- a/pkg/mcclient/modules/mod_projects.go +++ b/pkg/mcclient/modules/mod_projects.go @@ -317,8 +317,20 @@ func (this *ProjectManagerV3) DoCreateProject(s *mcclient.ClientSession, p jsonu } // assgin users to project - users := _user.(*jsonutils.JSONArray).GetStringArray() - roles := _role.(*jsonutils.JSONArray).GetStringArray() + users := []string{} + roles := []string{} + if _user != nil { + if _u, ok := _user.(*jsonutils.JSONArray); ok { + users = _u.GetStringArray() + } + } + + if _role != nil { + if _r, ok := _role.(*jsonutils.JSONArray); ok { + roles = _r.GetStringArray() + } + } + if len(users) > 0 && len(roles) > 0 { var projectG errgroup.Group diff --git a/pkg/mcclient/modules/mod_users.go b/pkg/mcclient/modules/mod_users.go index bb8b436957..9dfe29ca0d 100644 --- a/pkg/mcclient/modules/mod_users.go +++ b/pkg/mcclient/modules/mod_users.go @@ -186,8 +186,20 @@ func (this *UserManagerV3) DoCreateUser(s *mcclient.ClientSession, p jsonutils.J } // assgin project & role - projects := _project.(*jsonutils.JSONArray).GetStringArray() - roles := _role.(*jsonutils.JSONArray).GetStringArray() + projects := []string{} + roles := []string{} + if _project != nil { + if _p, ok := _project.(*jsonutils.JSONArray); ok { + projects = _p.GetStringArray() + } + } + + if _role != nil { + if _r, ok := _role.(*jsonutils.JSONArray); ok { + roles = _r.GetStringArray() + } + } + if len(projects) > 0 && len(roles) > 0 { var projectG errgroup.Group