Problem:
Attempting a clean install of foreman with the salt plugins and a remote salt master. Base install performed using “sudo foreman-installer” completes without issue. Next I run “sudo foreman-installer --enable-foreman-plugin-salt --enable-foreman-proxy-plugin-salt” as per the documentation and the installer’s standard out fails with the following errors:
[ERROR ] [configure] '/usr/sbin/foreman-rake db:migrate' returned 1 instead of one of [0]
[ERROR ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]/returns: change from 'notrun' to ['0'] failed: '/usr/sbin/foreman-rake db:migrate' returned 1 instead of one of [0]
Digging into /var/log/foreman-installer/foreman.log I see this problem:
2023-03-03 06:09:01 [DEBUG ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]: Starting to evaluate the resource (932 of 1389)
2023-03-03 06:09:01 [DEBUG ] [configure] Exec[foreman-rake-db:migrate](provider=posix): Executing check '/usr/sbin/foreman-rake db:abort_if_pending_migrations'
2023-03-03 06:09:01 [DEBUG ] [configure] Executing with uid=foreman: '/usr/sbin/foreman-rake db:abort_if_pending_migrations'
2023-03-03 06:09:07 [DEBUG ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]/unless: Run `bin/rails db:migrate` to update your database then try again.
2023-03-03 06:09:07 [DEBUG ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]/unless: You have 7 pending migrations:
2023-03-03 06:09:07 [DEBUG ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]/unless: 20211108211312 AddMissingPermissions
2023-03-03 06:09:07 [DEBUG ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]/unless: 20211123170430 TasksSettingsToDslCategory
2023-03-03 06:09:07 [DEBUG ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]/unless: 20220118160349 DropSaltHideRunSaltButtonSetting
2023-03-03 06:09:07 [DEBUG ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]/unless: 20220321101835 RenameSshProviderToScript
2023-03-03 06:09:07 [DEBUG ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]/unless: 20220331112719 AddSshUserToJobInvocation
2023-03-03 06:09:07 [DEBUG ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]/unless: 20220406185204 FixSaltSettingCategoryToDsl
2023-03-03 06:09:07 [DEBUG ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]/unless: 2021051713291621250977 AddHostProxyInvocations
2023-03-03 06:09:07 [DEBUG ] [configure] Exec[foreman-rake-db:migrate](provider=posix): Executing '/usr/sbin/foreman-rake db:migrate'
2023-03-03 06:09:07 [DEBUG ] [configure] Executing with uid=foreman: '/usr/sbin/foreman-rake db:migrate'
2023-03-03 06:09:14 [INFO ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]/returns: rake aborted!
2023-03-03 06:09:14 [INFO ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]/returns: StandardError: An error has occurred, this and all later migrations canceled:
2023-03-03 06:09:14 [INFO ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]/returns:
2023-03-03 06:09:14 [INFO ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]/returns: Validation failed: Name has already been taken
2023-03-03 06:09:14 [INFO ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]/returns: /usr/share/foreman/vendor/ruby/2.7.0/gems/activerecord-6.1.6.1/lib/active_record/validations.rb:80:in `raise_validation_error'
...
...
2023-03-03 06:09:14 [INFO ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]/returns: /usr/share/foreman/vendor/ruby/2.7.0/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
2023-03-03 06:09:14 [INFO ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]/returns:
2023-03-03 06:09:14 [INFO ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]/returns: Caused by:
2023-03-03 06:09:14 [INFO ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]/returns: ActiveRecord::RecordInvalid: Validation failed: Name has already been taken
2023-03-03 06:09:14 [INFO ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]/returns: /usr/share/foreman/vendor/ruby/2.7.0/gems/activerecord-6.1.6.1/lib/active_record/validations.rb:80:in `raise_validation_error'
2023-03-03 06:09:14 [INFO ] [configure] /Stage[main]/Foreman::Database/Foreman::Rake[db:migrate]/Exec[foreman-rake-db:migrate]/returns: /usr/share/foreman/vendor/ruby/2.7.0/gems/activerecord-6.1.6.1/lib/active_record/validations.rb:53:in `save!'
I’ve retried this multiple times with version 3.5, my most recent attempt I dropped down to 3.4 in hopes this behavior was specific to 3.5. I can run a clean install with --enable-foreman-proxy-plugin-salt with no errors, the errors appear specifically when adding --enable-foreman-plugin-salt.
Expected outcome:
Visible salt modules in web gui
Foreman and Proxy versions:
Foreman 3.4, Foreman-proxy 3.4
Foreman and Proxy plugin versions:
Distribution and version:
Ubuntu 20.04 LTS
Other relevant data:
If I manually re-run foreman-rake db:migrate as suggested by multiple older threads there is no positive effect. Restarting foreman or rebooting the server results in error banner:
ERF64-6496 [Foreman::MaintenanceException]: There are migrations pending in the system. ====
Again, I’ve only run those two foreman-installer commands so the only host visible under Hosts is the foreman server itself, same for the Operating Systems section. Previous runs I tried deleting the entry under Hosts dna Operating System but that didn’ help, I simply have no idea what “Name” its complaining about.