Merge pull request #4597 from rainzm/bugfix/guest_template_password

Bugfix/guest template password
This commit is contained in:
Zexi Li
2020-01-04 22:03:12 +08:00
committed by GitHub
3 changed files with 10 additions and 0 deletions
+1
View File
@@ -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 {
+7
View File
@@ -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
}
+2
View File
@@ -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")