简体   繁体   中英

Not able to reset foreman admin password using foreman-rake

I am trying to migrate database to mysql from sqlite. Database migrated successfully using foreman-mysql2. After restarting foreman, I wasn't allowed to login with admin/changeme.

I then tried to reset password using the below command

foreman-rake permission-reset password=secret

But I am getting the below error

rake aborted!

Don't know how to build task 'permission:reset' (see --tasks) /usr/share/foreman/vendor/ruby/1.9.1/gems/rake-10.5.0/lib/rake/task_manager.rb:62:in []' /usr/share/foreman/vendor/ruby/1.9.1/gems/rake-10.5.0/lib/rake/application.rb:149:in invoke_task' /usr/share/foreman/vendor/ruby/1.9.1/gems/rake-10.5.0/lib/rake/application.rb:106:in block (2 levels) in top_level' /usr/share/foreman/vendor/ruby/1.9.1/gems/rake-10.5.0/lib/rake/application.rb:106:in each' /usr/share/foreman/vendor/ruby/1.9.1/gems/rake-10.5.0/lib/rake/application.rb:106:in block in top_level' /usr/share/foreman/vendor/ruby/1.9.1/gems/rake-10.5.0/lib/rake/application.rb:115:in run_with_threads' /usr/share/foreman/vendor/ruby/1.9.1/gems/rake-10.5.0/lib/rake/application.rb:100:in top_level' /usr/share/foreman/vendor/ruby/1.9.1/gems/rake-10.5.0/lib/rake/application.rb:78:in block in run' /usr/share/foreman/vendor/ruby/1.9.1/gems/rake-10.5.0/lib/rake/application.rb:176:in standard_exception_handling' /usr/share/foreman/vendor/ruby/1.9.1/gems/rake-10.5.0/lib/rake/application.rb:75:in standard_exception_handling' /usr/share/foreman/vendor/ruby/1.9.1/gems/rake-10.5.0/lib/rake/application.rb:75:in run' /usr/bin/rake1.9.1:32:in `'

I am posting answer for my own question

Its not permission.... Its permissions

when we get errors like this, just type --tasks at the end of the command and see rake list, make sure the one you are trying exists in that list..,

correct command:

sudo foreman-rake permissions:reset PASSWORD=secret

On running the above command, its likely that you might get another error

ERF42-7495
"Cannot find user foreman_admin when switching context" or "Cannot find user foreman_api_admin when switching context"

To fix this, just type the below command

foreman-rake db:seed

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM