Project

General

Profile

Bug #25524

allow matching prerelease versions in requires_foreman_plugin

Added by Ales Dujicek 6 months ago. Updated 5 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Plugins-Engines
Target version:
-
Difficulty:
Triaged:
No
Bugzilla link:
Team Backlog:
Fixed in Releases:
Found in Releases:

Description

Katello nightly does not start with tfm-rubygem-foreman_scc_manager plugin

  1. yum install tfm-rubygem-foreman_scc_manager
  2. systemctl restart httpd

load UI:

Web application could not be started

ERF72-4785 [Foreman::PluginRequirementError]: foreman_scc_manager plugin requires the katello plugin >= 3.7.0 but current is 3.10.0.pre.master (Foreman::PluginRequirementError)
/usr/share/foreman/app/registries/foreman/plugin.rb:193:in `requires_foreman_plugin'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_scc_manager-1.4.0/lib/foreman_scc_manager/engine.rb:22:in `block (2 levels) in <class:Engine>'
/usr/share/foreman/app/registries/foreman/plugin.rb:74:in `instance_eval'
/usr/share/foreman/app/registries/foreman/plugin.rb:74:in `register'
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_scc_manager-1.4.0/lib/foreman_scc_manager/engine.rb:20:in `block in <class:Engine>'
...

When I changed
/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_scc_manager-1.4.0/lib/foreman_scc_manager/engine.rb
to
requires_foreman_plugin 'katello', '>= 3.10.0.pre.master'

A class was passed to `:class_name` but we are expecting a string. (ArgumentError)
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/reflection.rb:436:in `initialize'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/reflection.rb:31:in `new'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/reflection.rb:31:in `create'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/associations/builder/association.rb:45:in `create_reflection'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activerecord-5.2.1/lib/active_record/associations/builder/association.rb:31:in `build'
...

package versions:
katello-3.10.0-6.el7.noarch
foreman-1.21.0-0.201811201830git6bbaa990.4.develop.el7.noarch
tfm-rubygem-foreman_scc_manager-1.4.0-3.fm1_20.el7.noarch

Associated revisions

Revision f531bb90 (diff)
Added by Chris Duryee 5 months ago

Fixes #25524 - allow matching prerelease versions

Previously, `requires_foreman_plugin` did not account for prerelease
versions, so if you required Katello 3.8 or later, Katello 3.10
prerelease would not satisfy the requirement.

This commit adds a `allow_prerelease` parameter which is enabled by
default. When set to true, prerelease versions are acceptable for
version matching.

For example:

```ruby
requires_foreman_plugin 'katello', '>= 3.8.0'

requires_foreman_plugin 'katello', '>= 3.8.0', true
```

History

#1 Updated by John Mitsch 6 months ago

  • Status changed from New to Need more information

Do you know if the foreman_scc_plugin works with standalone foreman?

#2 Updated by Ales Dujicek 6 months ago

  • Status changed from Need more information to New

That plugin is in katello repository, should it work without katello?

Anyway, it doesn't.

Web application could not be started

undefined method `actions' for nil:NilClass (NoMethodError)
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.10.0.pre.master/lib/katello/permissions/organization_permissions.rb:3:in `<top (required)>'
/opt/rh/rh-ruby25/root/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:59:in `require'
/opt/rh/rh-ruby25/root/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:59:in `require'
/opt/theforeman/tfm/root/usr/share/gems/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `block in require'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:253:in `load_dependency'
/opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `require'
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.10.0.pre.master/lib/katello/permissions.rb:2:in `block in <top (required)>'
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.10.0.pre.master/lib/katello/permissions.rb:1:in `each'
...

#3 Updated by Christine Fouant 6 months ago

  • Triaged changed from No to Yes
  • Target version set to Katello Backlog
  • Assignee set to Chris Duryee

#4 Updated by Chris Duryee 6 months ago

It looks like the version matcher doesn't like the ".pre.master" at the end of the string:

irb(main):007:0> Gem::Dependency.new('', ' >= 3.7.0').match?('', '3.10.0')
=> true
irb(main):008:0> Gem::Dependency.new('', ' >= 3.7.0').match?('', '3.10.0.pre.master')
=> false

#5 Updated by Chris Duryee 6 months ago

I think if foreman supported setting the "prerelease" attribute when matching versions, this would work. For example:

irb(main):005:0> matcher = Gem::Dependency.new('', ' >= 3.7.0')
=> <Gem::Dependency type=:runtime name="" requirements=">= 3.7.0">
irb(main):006:0> matcher.prerelease = true
=> true
irb(main):007:0> matcher.match?('', '3.10.0.pre.master')
=> true
irb(main):008:0> matcher.prerelease = false
=> false
irb(main):009:0> matcher.match?('', '3.10.0.pre.master')
=> false

#6 Updated by Chris Duryee 6 months ago

  • Target version deleted (Katello Backlog)
  • Subject changed from foreman_scc_manager to allow matching prerelease versions in requires_foreman_plugin
  • Project changed from Katello to Foreman

#7 Updated by Chris Duryee 6 months ago

  • Triaged changed from Yes to No
  • Assignee deleted (Chris Duryee)

#8 Updated by Chris Duryee 6 months ago

  • Assignee set to Chris Duryee
  • Category set to Plugins-Engines

#9 Updated by Chris Duryee 6 months ago

  • Found in Releases 1.21.0 added
  • Found in Releases deleted (Katello 3.10.0)

#10 Updated by The Foreman Bot 6 months ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/6313 added

#11 Updated by Tomer Brisker 5 months ago

  • Fixed in Releases 1.21.0 added

#12 Updated by Chris Duryee 5 months ago

  • Status changed from Ready For Testing to Closed

Also available in: Atom PDF