Installation of virt-who plugin fails

Problem:
Hi,

after a clean foreman-installer run with default settings the installation of the virt-who plugin fails on the db migrate task:

/opt/theforeman/tfm/root/usr/share/gems/gems/sequel-4.20.0/lib/sequel/database/schema_generator.rb:19: warning: constant ::Fixnum is deprecated
/opt/theforeman/tfm/root/usr/share/gems/gems/sequel-4.20.0/lib/sequel/database/schema_generator.rb:19: warning: constant ::Bignum is deprecated
/usr/share/foreman/lib/foreman.rb:8: warning: already initialized constant Foreman::UUID_REGEXP
/usr/share/foreman/lib/foreman.rb:8: warning: previous definition of UUID_REGEXP was here
/usr/share/foreman/lib/core_extensions.rb:183: warning: already initialized constant ActiveSupport::MessageEncryptor::DEFAULT_CIPHER
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.4/lib/active_support/message_encryptor.rb:22: warning: previous definition of DEFAULT_CIPHER was here
The PGconn, PGresult, and PGError constants are deprecated, and will be
removed as of version 1.0.

You should use PG::Connection, PG::Result, and PG::Error instead, respectively.

Called from /opt/theforeman/tfm/root/usr/share/gems/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:

Directly inheriting from ActiveRecord::Migration is not supported. Please specify the Rails release the migration was written for:

  class CreateServiceUsers < ActiveRecord::Migration[4.2]
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/migration.rb:525:in `inherited'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_virt_who_configure-0.1.1/db/migrate/20170102152649_create_service_users.rb:1:in `<top (required)>'
/opt/theforeman/tfm/root/usr/share/gems/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `block in require'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:258:in `load_dependency'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/migration.rb:962:in `load_migration'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/migration.rb:958:in `migration'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/migration.rb:953:in `disable_ddl_transaction'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/migration.rb:1305:in `use_transaction?'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/migration.rb:1297:in `ddl_transaction'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/migration.rb:1229:in `execute_migration_in_transaction'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/migration.rb:1201:in `block in migrate_without_lock'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/migration.rb:1200:in `each'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/migration.rb:1200:in `migrate_without_lock'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/migration.rb:1148:in `block in migrate'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/migration.rb:1317:in `with_advisory_lock'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/migration.rb:1148:in `migrate'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/migration.rb:1007:in `up'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/migration.rb:985:in `migrate'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/tasks/database_tasks.rb:171:in `migrate'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/railties/databases.rake:58:in `block (2 levels) in <top (required)>'
/opt/rh/rh-ruby24/root/usr/share/gems/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'
StandardError: Directly inheriting from ActiveRecord::Migration is not supported. Please specify the Rails release the migration was written for:

  class CreateServiceUsers < ActiveRecord::Migration[4.2]
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/migration.rb:525:in `inherited'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_virt_who_configure-0.1.1/db/migrate/20170102152649_create_service_users.rb:1:in `<top (required)>'
/opt/theforeman/tfm/root/usr/share/gems/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `block in require'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:258:in `load_dependency'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/migration.rb:962:in `load_migration'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/migration.rb:958:in `migration'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/migration.rb:953:in `disable_ddl_transaction'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/migration.rb:1305:in `use_transaction?'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/migration.rb:1297:in `ddl_transaction'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/migration.rb:1229:in `execute_migration_in_transaction'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/migration.rb:1201:in `block in migrate_without_lock'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/migration.rb:1200:in `each'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/migration.rb:1200:in `migrate_without_lock'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/migration.rb:1148:in `block in migrate'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/migration.rb:1317:in `with_advisory_lock'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/migration.rb:1148:in `migrate'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/migration.rb:1007:in `up'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/migration.rb:985:in `migrate'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/tasks/database_tasks.rb:171:in `migrate'
/opt/theforeman/tfm-ror51/root/usr/share/gems/gems/activerecord-5.1.4/lib/active_record/railties/databases.rake:58:in `block (2 levels) in <top (required)>'
/opt/rh/rh-ruby24/root/usr/share/gems/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'
Tasks: TOP => db:migrate

My steps:

foreman-installer --scenario katello
yum -y install tfm-rubygem-foreman_virt_who_configure.noarch
foreman-rake db:migrate

Expected outcome:
Successfully installation of virt-who plugin.

Foreman and Proxy versions:
CentOS 7.5.1804
Foreman 1.17.1
Foreman-Proxy 1.17.1
Katello 3.6.0

Foreman and Proxy plugin versions:
tfm-rubygem-foreman_virt_who_configure-0.1.1-1.fm1_16.el7.noarch.rpm (the version seems to target Foreman 1.16 release?)

Other relevant data:
trace.txt.gz (1.3 KB)

1 Like

Hello @Arledrian,
Looks like you are trying to install an older version of the plugin indeed. For some reason, the updated version didn’t make it into the katello 3.6 repos. Perhaps @ehelms or @Marek_Hulan can check what needs to be fixed to get the correct version in place?

For Foreman 1.17 you need to update virt_who plugin to 2.0+. It’s a bit weird since Katello 3.6 requires Foreman 1.16+ while virt_who plugin 2.0+ requires Foreman 1.17+. So your combination of plugins does not work with these versions, if Katello 3.6 is in general compatible with 1.17, just get the virt who plugin from Katello 3.7 [1] and it should work. And update Katello to 3.7 as soon as possible.

[1] https://fedorapeople.org/groups/katello/releases/yum/3.7/katello/el7/x86_64/

When executing foreman-rake db:migrate I get the following error:

Foreman::PluginRequirementError: ERF72-2507 [Foreman::PluginRequirementError]: foreman_virt_who_configure plugin requires Foreman >= 1.18 but current is 1.17.1

I installed the plugin tfm-rubygem-foreman_virt_who_configure-0.2.1-1.fm1_18.el7.noarch.rpm from the Katello 3.7 repo.

Where can I find the 2.0+ plugin compatible with 1.17?

Oh sorry, I haven’t realized 0.2.1 already requires Foreman 1.18. I think this version should work in your env [1] since it contains fixes for 1.17 but still says it requires 1.16+.

https://fedorapeople.org/groups/katello/releases/yum/nightly/katello/el7/x86_64/tfm-rubygem-foreman_virt_who_configure-0.2.0-1.fm1_18.el7.noarch.rpm

Hope that helps

–
Marek

Yes this works.

Thank you @Marek_Hulan

@Marek_Hulan

This rpm is not available anymore.
Where can I find a working version of the virt_who plugin compatible with 1.17?

You should be able to get it from here - http://koji.katello.org/kojifiles/packages/tfm-rubygem-foreman_virt_who_configure/0.2.0/1.fm1_18.el7/noarch/tfm-rubygem-foreman_virt_who_configure-0.2.0-1.fm1_18.el7.noarch.rpm

Sorry for the mess, there’s gonna be compatible one with Foreman 1.18 and Katello 3.7 in our repos.

Hi Marek,

I hit same issue than OP and I land here. The RPM update made the magic (thank you).

Quick question regarding your last comment : “And update Katello to 3.7 as soon as possible”.

I am looking for a stable solution (enterprise deployment). Considering that 3.7 is still in RC, would you say this version is stable ?

I’d say it is, but if you wait just a bit more, Katello 3.7 GA should land.

Thank you, I’ll make some tests and wait for GA to go in production :slight_smile:

3.7 seems a bit broken with the virtwho plugin version 0.2.1-1.fm1_18.el7 (from katello-3.7 repo):

  • the foreman-rakedb:migrate fails (same error than OP “/opt/rh/rh-ruby24/root/usr/share/gems/gems/rake-12.0.0/exe/rake:27:in `<top (required)>’”)
  • the GUI does not start:

Web application could not be started

ERF72-8098 [Foreman::PluginRequirementError]: foreman_virt_who_configure plugin requires the katello plugin >= 3.0.0 but current is 3.7.0.rc1 (Foreman::PluginRequirementError)

I think that’s because of rc1 is part of gem version, ruby gems should not contain text parts IIRC.