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 } 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")