无法使用工头耙重置工头管理员密码

Not able to reset foreman admin password using foreman-rake

我正在尝试将数据库从 sqlite 迁移到 mysql。使用 foreman-mysql2 成功迁移数据库。重新启动 foreman 后,我无法使用 admin/changeme 登录。

然后我尝试使用以下命令重设密码

foreman-rake permission-reset password=secret

但我收到以下错误

耙子中止!

不知道如何构建任务'permission:reset'(参见--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:ininvoke_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每个' /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:inrun_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:inblock in 运行' /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运行' /usr/bin/rake1.9.1:32:在`'

我正在发布我自己问题的答案

未经许可.... 它的权限

当我们遇到这样的错误时,只需在命令末尾键入 --tasks 并查看 rake 列表,确保您尝试的那个在该列表中存在..,

正确命令:

sudo foreman-rake permissions:reset PASSWORD=secret

在运行上面的命令中,您可能会遇到另一个错误

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

要解决此问题,只需键入以下命令

foreman-rake db:seed