Db:seed fails to create admin user -- already there

Problem:
foreman-installer --reset-data fails at the db:seed step to create the admin user
can’t log into the “reset” foreman because the old admin password doesn’t work and have no idea what the new one is

Expected outcome:
the database is reset and a new password issued for admin

Foreman and Proxy versions:
foreman 2.3.2
katello 3.18

Distribution and version:
centos 7

Other relevant data:
2021-01-30 09:24:51 [NOTICE] [configure] 1600 out of 2325 done.
2021-01-30 09:26:28 [ERROR ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]: Failed to call refresh: ‘/usr/sbin/foreman-rake db:seed’ returned 1 instead of one of [0]
2021-01-30 09:26:28 [ERROR ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:seed]/Exec[foreman-rake-db:seed]: ‘/usr/sbin/foreman-rake db:seed’ returned 1 instead of one of [0]
2021-01-30 09:26:28 [NOTICE] [configure] 1700 out of 2325 done.

running it manually, reports the admin user already exists

[root@foreman ~]# foreman-rake db:seed
User with login admin already exists, not seeding as admin.
rake aborted!
Foreman::Exception: ERF42-9500 [Foreman::Exception]: Unknown remote execution feature katello_module_stream_action
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_remote_execution-4.2.2/app/models/remote_execution_feature.rb:23:in `feature'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_remote_execution-4.2.2/app/models/job_template.rb:171:in `sync_feature'
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.18.1/db/seeds.d/150-module_job_templates.rb:6:in `block (2 levels) in <top (required)>'
/opt/theforeman/tfm/root/usr/share/gems/gems/audited-4.9.0/lib/audited/auditor.rb:376:in `without_auditing'
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.18.1/db/seeds.d/150-module_job_templates.rb:3:in `block in <top (required)>'
/usr/share/foreman/app/models/concerns/foreman/thread_session.rb:108:in `as'
/usr/share/foreman/app/models/concerns/foreman/thread_session.rb:114:in `as_anonymous_admin'
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.18.1/db/seeds.d/150-module_job_templates.rb:2:in `<top (required)>'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.4/lib/active_support/dependencies.rb:318:in `load'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.4/lib/active_support/dependencies.rb:318:in `block in load'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.4/lib/active_support/dependencies.rb:291:in `load_dependency'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.4/lib/active_support/dependencies.rb:318:in `load'
/usr/share/foreman/app/services/foreman_seeder.rb:46:in `block (2 levels) in execute'
/usr/share/foreman/app/models/concerns/foreman/thread_session.rb:108:in `as'
/usr/share/foreman/app/models/concerns/foreman/thread_session.rb:114:in `as_anonymous_admin'
/usr/share/foreman/app/services/foreman_seeder.rb:45:in `block in execute'
/usr/share/foreman/app/services/foreman_seeder.rb:39:in `each'
/usr/share/foreman/app/services/foreman_seeder.rb:39:in `execute'
/usr/share/foreman/db/seeds.rb:14:in `<top (required)>'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.4/lib/active_support/dependencies.rb:318:in `load'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.4/lib/active_support/dependencies.rb:318:in `block in load'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.4/lib/active_support/dependencies.rb:291:in `load_dependency'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.4/lib/active_support/dependencies.rb:318:in `load'
/opt/theforeman/tfm/root/usr/share/gems/gems/railties-6.0.3.4/lib/rails/engine.rb:559:in `load_seed'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.4/lib/active_record/tasks/database_tasks.rb:440:in `load_seed'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.4/lib/active_record/railties/databases.rake:331:in `block (2 levels) in <top (required)>'
/opt/rh/rh-ruby25/root/usr/share/gems/gems/rake-12.3.0/exe/rake:27:in `<top (required)>'
Tasks: TOP => db:seed

the admin password in /etc/foreman-installer/scenarios.d/katello-answers.yaml

so the issue really is that db:seed needs to be OK to continue if the user exists
and the installer should report that admin password back so users don’t have to hunting for it :slightly_smiling_face:

update on this:
the DB:SEED is not failing on the admin password – it just doesn’t show it because it actually fails while import the remote execution features.

[root@foreman seeds.d]# foreman-rake db:seed --trace
** Invoke db:seed (first_time)
** Invoke db:load_config (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:load_config
** Execute db:seed
** Invoke db:abort_if_pending_migrations (first_time)
** Invoke db:load_config 
** Execute db:abort_if_pending_migrations
** Invoke dynflow:abort_if_pending_migrations (first_time)
** Invoke environment 
** Execute dynflow:abort_if_pending_migrations
rake aborted!
Foreman::Exception: ERF42-9500 [Foreman::Exception]: Unknown remote execution feature katello_module_stream_action
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_remote_execution-4.2.2/app/models/remote_execution_feature.rb:23:in `feature'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_remote_execution-4.2.2/app/models/job_template.rb:171:in `sync_feature'
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.18.1/db/seeds.d/150-module_job_templates.rb:6:in `block (2 levels) in <top (required)>'
/opt/theforeman/tfm/root/usr/share/gems/gems/audited-4.9.0/lib/audited/auditor.rb:376:in `without_auditing'
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.18.1/db/seeds.d/150-module_job_templates.rb:3:in `block in <top (required)>'