From d9f4134f7fc06ebaebdd202b2a109bc40e10e97b Mon Sep 17 00:00:00 2001 From: Rain Date: Sat, 4 Jan 2020 21:33:33 +0800 Subject: [PATCH 1/2] fix(region): Add reset_password in guest template's ConfigInfo --- pkg/apis/compute/guesttemplate.go | 1 + pkg/compute/models/guest_template.go | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/pkg/apis/compute/guesttemplate.go b/pkg/apis/compute/guesttemplate.go index 8e4423c96f..0ae0750101 100644 --- a/pkg/apis/compute/guesttemplate.go +++ b/pkg/apis/compute/guesttemplate.go @@ -55,6 +55,7 @@ type GuesttemplateConfigInfo struct { Secgroup string `json:"secgroup"` IsolatedDeviceConfig []IsolatedDeviceConfig `json:"isolated_device_config"` Image string `json:"image"` + ResetPassword bool `json:"reset_password"` } type GuesttemplateDisk struct { diff --git a/pkg/compute/models/guest_template.go b/pkg/compute/models/guest_template.go index ffa3914c9c..628617de6c 100644 --- a/pkg/compute/models/guest_template.go +++ b/pkg/compute/models/guest_template.go @@ -329,6 +329,13 @@ func (gt *SGuestTemplate) getMoreDetailsV2(ctx context.Context, userCred mcclien // no arrivals } + // reset_password + if input.ResetPassword == nil { + configInfo.ResetPassword = false + } else { + configInfo.ResetPassword = *input.ResetPassword + } + out.ConfigInfo = configInfo return } From b17d299a478c68308f4297f8b329bca82592ca8f Mon Sep 17 00:00:00 2001 From: Rain Date: Sat, 4 Jan 2020 21:34:17 +0800 Subject: [PATCH 2/2] fix(region): Cancel the check about project when creating service catlog --- pkg/compute/models/service_catalog.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkg/compute/models/service_catalog.go b/pkg/compute/models/service_catalog.go index 7718e2cc6e..f6bb31d77e 100644 --- a/pkg/compute/models/service_catalog.go +++ b/pkg/compute/models/service_catalog.go @@ -102,6 +102,7 @@ func (scm *SServiceCatalogManager) ValidateCreateData(ctx context.Context, userC if err != nil { return nil, err } + /* gt := model.(*SGuestTemplate) //scope := rbacutils.String2Scope(gt.PublicScope) //if !gt.IsPublic || scope != rbacutils.ScopeSystem { @@ -110,6 +111,7 @@ func (scm *SServiceCatalogManager) ValidateCreateData(ctx context.Context, userC if userCred.GetProjectId() != gt.ProjectId { return nil, httperrors.NewForbiddenError("guest template must has same project id with the request") } + */ data := input.JSON(input) data.Remove("guest_template")