Merge pull request #1950 from swordqiu/feature/qj-keystone-reset-admin-user-password

feature: allow keystone reset sysadmin password at boot
This commit is contained in:
yunion-ci-robot
2019-07-26 21:34:06 +08:00
committed by GitHub
2 changed files with 14 additions and 0 deletions
+13
View File
@@ -178,6 +178,19 @@ func (manager *SUserManager) initSysUser() error {
return errors.Wrap(err, "query")
}
if cnt == 1 {
// if ResetAdminUserPassword is true, reset sysadmin password
if options.Options.ResetAdminUserPassword {
usr := SUser{}
usr.SetModelManager(manager, &usr)
err = q.First(&usr)
if err != nil {
return errors.Wrap(err, "ResetAdminUserPassword Query user")
}
err = usr.initLocalData(options.Options.BootstrapAdminUserPassword)
if err != nil {
return errors.Wrap(err, "initLocalData")
}
}
return nil
}
if cnt > 2 {
+1
View File
@@ -31,6 +31,7 @@ type SKeystoneOptions struct {
// SetupStateKey bool `help:"setup standalone fernet keys for openid state" token:"setup_state_key"`
BootstrapAdminUserPassword string `help:"bootstreap sysadmin user password" default:"sysadmin"`
ResetAdminUserPassword bool `help:"reset sysadmin password if exists and this option is true"`
AutoSyncIntervalSeconds int `help:"frequency to check auto sync tasks" default:"30"`