Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #36525 - kickstart's RHSM line only works on RHEL hosts #9745

Merged
merged 1 commit into from
Apr 17, 2024
Merged

Fixes #36525 - kickstart's RHSM line only works on RHEL hosts #9745

merged 1 commit into from
Apr 17, 2024

Conversation

jcpunk
Copy link
Contributor

@jcpunk jcpunk commented Jun 21, 2023

This patch gets my self managed katello working again with foreman kickstarts.

@theforeman-bot
Copy link
Member

Issues: #36525

Copy link
Member

@ekohl ekohl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think rhinstaller/anaconda#2546 was a mistake and should be reverted. That would remove the need for this.

Also linking back https://community.theforeman.org/t/el9-kickstart-using-rhsm/32666 here.

@jcpunk
Copy link
Contributor Author

jcpunk commented Jun 27, 2023

Linking in https://bugzilla.redhat.com/show_bug.cgi?id=2211944

The initial driver for the anaconda patch is 99.9% of rebuild users don't use self managed katello so presenting them with the subscription-manager gui is a confusing experience.

Rebuilds and CentOS Stream shouldn't have a UI box for setting up subscriptions to RHN. The problem being, for folks with katello having access to subscription manager is useful.

ekohl
ekohl previously approved these changes Jul 4, 2023
Copy link
Member

@ekohl ekohl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm tempted to suggest a top level rhsm_compatible = @host.operatingsystem.name == 'RedHat' && os_major >= 9 and use that in both cases, similar to how we have realm_compatible on line 60, but I'm also fine with this version.

@jcpunk
Copy link
Contributor Author

jcpunk commented Jul 5, 2023

rebased off HEAD to try and get the tests to run better...

@ekohl
Copy link
Member

ekohl commented Jul 5, 2023

Test failures look relevant. I've opened #9769 to show how I think we could also make the tests pass, rather than adjust the fixtures. Feel free to consider both options and see what works best for you. I think the advantage of mine is that the rendered template is easier to review.

@ekohl
Copy link
Member

ekohl commented Jul 5, 2023

I should have noted that I didn't test my PR and I can now see it fails in various ways. Will you address the failures or should I?

@jcpunk
Copy link
Contributor Author

jcpunk commented Jul 5, 2023

I'm juggleing a few things today. Odds are I wont get back to this for a week or two... If you've got the time, I think you've got write access to my branch.

@jcpunk
Copy link
Contributor Author

jcpunk commented Jul 13, 2023

I finally found time to get back to this, The snippet 'redhat_register' threw an error: Safemode doesn't allow to access 'registration_type' on #<Safemode::ScopeObject> seems an odd error since I didn't add the registration_type var....

@jcpunk
Copy link
Contributor Author

jcpunk commented Jul 17, 2023

It would be super helpful if the tests indicated which template from the list it doesn't like...

I've never succeeded in generating the template snapshots locally...

Copy link
Contributor

@stejskalleos stejskalleos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this PR rendering the kickstart_default template on the CentOS host is failing on:

There was an error rendering the Kickstart default template: ERF42-7327 [Foreman::Exception]: The snippet 'redhat_register' threw an error: Safemode doesn't allow to access 'registration_type' on #<Safemode::ScopeObject>

@jcpunk
Copy link
Contributor Author

jcpunk commented Jul 27, 2023

Indeed it is. It seems an odd error since I didn't add the registration_type var in this PR....

Since I don't think I broke it, I'm not sure how to fix it...

@jcpunk
Copy link
Contributor Author

jcpunk commented Aug 25, 2023

@stejskalleos Any ideas how I can get this to work with registration_type? All I did was add a - to the %>. The actual definition and use is already in the code tree.

Copy link
Contributor

@stejskalleos stejskalleos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, sorry for the late response.

I added my suggestions, plus it would be good to rebase the branch over the latest develop, there were some changes, and task rails snapshots:generate is failing.

Copy link
Contributor

@stejskalleos stejskalleos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good to me but the snapshots must be updated. You can do this by running the command:

RAILS_ENV=test bundle exec rails snapshots:generate

@jcpunk
Copy link
Contributor Author

jcpunk commented Aug 30, 2023

hmmmmm

[riehecky@testify foreman]$ RAILS_ENV=test bundle exec rails snapshots:generate
rails aborted!
Cannot load database configuration:
Could not load database configuration. No such file - ["config/database.yml"]
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/railties-6.1.7.6/lib/rails/application/configuration.rb:294:in `database_configuration'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/activerecord-6.1.7.6/lib/active_record/railtie.rb:221:in `block (2 levels) in <class:Railtie>'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/activesupport-6.1.7.6/lib/active_support/lazy_load_hooks.rb:71:in `class_eval'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/activesupport-6.1.7.6/lib/active_support/lazy_load_hooks.rb:71:in `block in execute_hook'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/activesupport-6.1.7.6/lib/active_support/lazy_load_hooks.rb:61:in `with_execution_control'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/activesupport-6.1.7.6/lib/active_support/lazy_load_hooks.rb:66:in `execute_hook'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/activesupport-6.1.7.6/lib/active_support/lazy_load_hooks.rb:43:in `block in on_load'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/activesupport-6.1.7.6/lib/active_support/lazy_load_hooks.rb:42:in `each'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/activesupport-6.1.7.6/lib/active_support/lazy_load_hooks.rb:42:in `on_load'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/activerecord-6.1.7.6/lib/active_record/railtie.rb:217:in `block in <class:Railtie>'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/railties-6.1.7.6/lib/rails/initializable.rb:32:in `instance_exec'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/railties-6.1.7.6/lib/rails/initializable.rb:32:in `run'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/railties-6.1.7.6/lib/rails/initializable.rb:61:in `block in run_initializers'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/railties-6.1.7.6/lib/rails/initializable.rb:60:in `run_initializers'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/railties-6.1.7.6/lib/rails/application.rb:391:in `initialize!'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/railties-6.1.7.6/lib/rails/railtie.rb:207:in `public_send'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/railties-6.1.7.6/lib/rails/railtie.rb:207:in `method_missing'
/tmp/foo/foreman/config/environment.rb:5:in `<top (required)>'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/zeitwerk-2.6.11/lib/zeitwerk/kernel.rb:38:in `require'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/zeitwerk-2.6.11/lib/zeitwerk/kernel.rb:38:in `require'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/activesupport-6.1.7.6/lib/active_support/dependencies.rb:332:in `block in require'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/activesupport-6.1.7.6/lib/active_support/dependencies.rb:299:in `load_dependency'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/activesupport-6.1.7.6/lib/active_support/dependencies.rb:332:in `require'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/railties-6.1.7.6/lib/rails/application.rb:367:in `require_environment!'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/railties-6.1.7.6/lib/rails/application.rb:533:in `block in run_tasks_blocks'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `block in execute'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `each'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `execute'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:219:in `block in invoke_with_call_chain'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `synchronize'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `invoke_with_call_chain'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:243:in `block in invoke_prerequisites'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:241:in `each'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:241:in `invoke_prerequisites'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:218:in `block in invoke_with_call_chain'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `synchronize'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `invoke_with_call_chain'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:188:in `invoke'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/rake-13.0.6/lib/rake/application.rb:160:in `invoke_task'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `each'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `block in top_level'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/rake-13.0.6/lib/rake/application.rb:125:in `run_with_threads'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/rake-13.0.6/lib/rake/application.rb:110:in `top_level'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/railties-6.1.7.6/lib/rails/commands/rake/rake_command.rb:24:in `block (2 levels) in perform'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/rake-13.0.6/lib/rake/application.rb:186:in `standard_exception_handling'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/railties-6.1.7.6/lib/rails/commands/rake/rake_command.rb:24:in `block in perform'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/rake-13.0.6/lib/rake/rake_module.rb:59:in `with_application'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/railties-6.1.7.6/lib/rails/commands/rake/rake_command.rb:18:in `perform'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/railties-6.1.7.6/lib/rails/command.rb:50:in `invoke'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/railties-6.1.7.6/lib/rails/commands.rb:18:in `<top (required)>'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/activesupport-6.1.7.6/lib/active_support/dependencies.rb:332:in `require'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/activesupport-6.1.7.6/lib/active_support/dependencies.rb:332:in `block in require'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/activesupport-6.1.7.6/lib/active_support/dependencies.rb:299:in `load_dependency'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/activesupport-6.1.7.6/lib/active_support/dependencies.rb:332:in `require'
/tmp/foo/foreman/bin/rails:9:in `<top (required)>'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `load'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `call'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/spring-2.1.1/lib/spring/client/command.rb:7:in `call'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/spring-2.1.1/lib/spring/client.rb:30:in `run'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/spring-2.1.1/bin/spring:49:in `<top (required)>'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `load'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `<top (required)>'
/tmp/foo/foreman/bin/spring:13:in `require'
/tmp/foo/foreman/bin/spring:13:in `<top (required)>'

Caused by:
Could not load database configuration. No such file - ["config/database.yml"]
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/railties-6.1.7.6/lib/rails/application/configuration.rb:294:in `database_configuration'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/activerecord-6.1.7.6/lib/active_record/railtie.rb:221:in `block (2 levels) in <class:Railtie>'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/activesupport-6.1.7.6/lib/active_support/lazy_load_hooks.rb:71:in `class_eval'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/activesupport-6.1.7.6/lib/active_support/lazy_load_hooks.rb:71:in `block in execute_hook'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/activesupport-6.1.7.6/lib/active_support/lazy_load_hooks.rb:61:in `with_execution_control'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/activesupport-6.1.7.6/lib/active_support/lazy_load_hooks.rb:66:in `execute_hook'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/activesupport-6.1.7.6/lib/active_support/lazy_load_hooks.rb:43:in `block in on_load'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/activesupport-6.1.7.6/lib/active_support/lazy_load_hooks.rb:42:in `each'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/activesupport-6.1.7.6/lib/active_support/lazy_load_hooks.rb:42:in `on_load'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/activerecord-6.1.7.6/lib/active_record/railtie.rb:217:in `block in <class:Railtie>'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/railties-6.1.7.6/lib/rails/initializable.rb:32:in `instance_exec'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/railties-6.1.7.6/lib/rails/initializable.rb:32:in `run'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/railties-6.1.7.6/lib/rails/initializable.rb:61:in `block in run_initializers'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/railties-6.1.7.6/lib/rails/initializable.rb:60:in `run_initializers'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/railties-6.1.7.6/lib/rails/application.rb:391:in `initialize!'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/railties-6.1.7.6/lib/rails/railtie.rb:207:in `public_send'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/railties-6.1.7.6/lib/rails/railtie.rb:207:in `method_missing'
/tmp/foo/foreman/config/environment.rb:5:in `<top (required)>'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/zeitwerk-2.6.11/lib/zeitwerk/kernel.rb:38:in `require'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/zeitwerk-2.6.11/lib/zeitwerk/kernel.rb:38:in `require'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/activesupport-6.1.7.6/lib/active_support/dependencies.rb:332:in `block in require'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/activesupport-6.1.7.6/lib/active_support/dependencies.rb:299:in `load_dependency'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/activesupport-6.1.7.6/lib/active_support/dependencies.rb:332:in `require'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/railties-6.1.7.6/lib/rails/application.rb:367:in `require_environment!'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/railties-6.1.7.6/lib/rails/application.rb:533:in `block in run_tasks_blocks'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `block in execute'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `each'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:281:in `execute'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:219:in `block in invoke_with_call_chain'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `synchronize'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `invoke_with_call_chain'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:243:in `block in invoke_prerequisites'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:241:in `each'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:241:in `invoke_prerequisites'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:218:in `block in invoke_with_call_chain'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `synchronize'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:199:in `invoke_with_call_chain'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:188:in `invoke'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/rake-13.0.6/lib/rake/application.rb:160:in `invoke_task'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `each'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/rake-13.0.6/lib/rake/application.rb:116:in `block in top_level'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/rake-13.0.6/lib/rake/application.rb:125:in `run_with_threads'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/rake-13.0.6/lib/rake/application.rb:110:in `top_level'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/railties-6.1.7.6/lib/rails/commands/rake/rake_command.rb:24:in `block (2 levels) in perform'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/rake-13.0.6/lib/rake/application.rb:186:in `standard_exception_handling'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/railties-6.1.7.6/lib/rails/commands/rake/rake_command.rb:24:in `block in perform'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/rake-13.0.6/lib/rake/rake_module.rb:59:in `with_application'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/railties-6.1.7.6/lib/rails/commands/rake/rake_command.rb:18:in `perform'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/railties-6.1.7.6/lib/rails/command.rb:50:in `invoke'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/railties-6.1.7.6/lib/rails/commands.rb:18:in `<top (required)>'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/activesupport-6.1.7.6/lib/active_support/dependencies.rb:332:in `require'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/activesupport-6.1.7.6/lib/active_support/dependencies.rb:332:in `block in require'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/activesupport-6.1.7.6/lib/active_support/dependencies.rb:299:in `load_dependency'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/activesupport-6.1.7.6/lib/active_support/dependencies.rb:332:in `require'
/tmp/foo/foreman/bin/rails:9:in `<top (required)>'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `load'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `call'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/spring-2.1.1/lib/spring/client/command.rb:7:in `call'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/spring-2.1.1/lib/spring/client.rb:30:in `run'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/spring-2.1.1/bin/spring:49:in `<top (required)>'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `load'
/tmp/foo/foreman/.vendor/ruby/3.0.0/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `<top (required)>'
/tmp/foo/foreman/bin/spring:13:in `require'
/tmp/foo/foreman/bin/spring:13:in `<top (required)>'
Tasks: TOP => snapshots:generate => environment
(See full trace by running task with --trace)

@jcpunk
Copy link
Contributor Author

jcpunk commented Dec 18, 2023

In theory I've sorted out the merge conflicts.

@jcpunk
Copy link
Contributor Author

jcpunk commented Jan 19, 2024

I'd love to have this in place for foreman 3.10...

@jcpunk
Copy link
Contributor Author

jcpunk commented Feb 13, 2024

@stejskalleos any luck with the templates?

@stejskalleos
Copy link
Contributor

Generating snapshots is broken right now, reopening PR which fix the problem: https://github.com/theforeman/foreman/pull/9530/files

@m-bucher
Copy link
Contributor

m-bucher commented Apr 8, 2024

@jcpunk with latest foreman develop branch generating snapshots works for me with the following command:

bundle exec rake snapshots:generate RAILS_ENV=test

May I ask you to rebase and try again?

@jcpunk
Copy link
Contributor Author

jcpunk commented Apr 8, 2024

Still no luck:

rails aborted!
Foreman::Exception: ERF42-6708 [Foreman::Exception]: Command /usr/bin/ct not found or unreadable
/tmp/foreman/lib/foreman/command_runner.rb:16:in `initialize'
/tmp/foreman/app/services/foreman/renderer/scope/macros/transpilers.rb:19:in `new'
/tmp/foreman/app/services/foreman/renderer/scope/macros/transpilers.rb:19:in `transpile_coreos_linux_config'
/tmp/foreman/vendor/bundle/ruby/3.0.0/gems/safemode-1.5.0/lib/safemode/scope.rb:37:in `method_missing'
/tmp/foreman/vendor/bundle/ruby/3.0.0/gems/safemode-1.5.0/lib/safemode.rb:52:in `eval'
/tmp/foreman/vendor/bundle/ruby/3.0.0/gems/safemode-1.5.0/lib/safemode.rb:52:in `eval'
/tmp/foreman/app/services/foreman/renderer/safe_mode_renderer.rb:7:in `render'
/tmp/foreman/app/services/foreman/renderer/base_renderer.rb:18:in `render'
/tmp/foreman/app/services/foreman/renderer.rb:46:in `render'
/tmp/foreman/app/services/foreman/template_snapshot_service.rb:49:in `render_template'
/tmp/foreman/lib/tasks/snapshots.rake:48:in `block (6 levels) in <top (required)>'
/tmp/foreman/lib/tasks/snapshots.rake:43:in `each'
/tmp/foreman/lib/tasks/snapshots.rake:43:in `block (5 levels) in <top (required)>'
/tmp/foreman/lib/tasks/snapshots.rake:42:in `each'
/tmp/foreman/lib/tasks/snapshots.rake:42:in `block (4 levels) in <top (required)>'
/tmp/foreman/app/models/concerns/foreman/thread_session.rb:108:in `as'
/tmp/foreman/lib/tasks/snapshots.rake:41:in `block (3 levels) in <top (required)>'
/tmp/foreman/vendor/bundle/ruby/3.0.0/gems/database_cleaner-1.99.0/lib/database_cleaner/generic/base.rb:16:in `cleaning'
/tmp/foreman/vendor/bundle/ruby/3.0.0/gems/forwardable-1.3.3/lib/forwardable.rb:240:in `cleaning'
/tmp/foreman/vendor/bundle/ruby/3.0.0/gems/database_cleaner-1.99.0/lib/database_cleaner/configuration.rb:88:in `block (2 levels) in cleaning'
/tmp/foreman/vendor/bundle/ruby/3.0.0/gems/database_cleaner-1.99.0/lib/database_cleaner/configuration.rb:89:in `cleaning'
/tmp/foreman/vendor/bundle/ruby/3.0.0/gems/forwardable-1.3.3/lib/forwardable.rb:240:in `cleaning'
/tmp/foreman/lib/tasks/snapshots.rake:33:in `block (2 levels) in <top (required)>'
/tmp/foreman/vendor/bundle/ruby/3.0.0/gems/rake-13.2.1/lib/rake/task.rb:281:in `block in execute'
/tmp/foreman/vendor/bundle/ruby/3.0.0/gems/rake-13.2.1/lib/rake/task.rb:281:in `each'
/tmp/foreman/vendor/bundle/ruby/3.0.0/gems/rake-13.2.1/lib/rake/task.rb:281:in `execute'
/tmp/foreman/vendor/bundle/ruby/3.0.0/gems/rake-13.2.1/lib/rake/task.rb:219:in `block in invoke_with_call_chain'
/tmp/foreman/vendor/bundle/ruby/3.0.0/gems/rake-13.2.1/lib/rake/task.rb:199:in `synchronize'
/tmp/foreman/vendor/bundle/ruby/3.0.0/gems/rake-13.2.1/lib/rake/task.rb:199:in `invoke_with_call_chain'
/tmp/foreman/vendor/bundle/ruby/3.0.0/gems/rake-13.2.1/lib/rake/task.rb:188:in `invoke'
/tmp/foreman/vendor/bundle/ruby/3.0.0/gems/rake-13.2.1/lib/rake/application.rb:188:in `invoke_task'
/tmp/foreman/vendor/bundle/ruby/3.0.0/gems/rake-13.2.1/lib/rake/application.rb:138:in `block (2 levels) in top_level'
/tmp/foreman/vendor/bundle/ruby/3.0.0/gems/rake-13.2.1/lib/rake/application.rb:138:in `each'
/tmp/foreman/vendor/bundle/ruby/3.0.0/gems/rake-13.2.1/lib/rake/application.rb:138:in `block in top_level'
/tmp/foreman/vendor/bundle/ruby/3.0.0/gems/rake-13.2.1/lib/rake/application.rb:147:in `run_with_threads'
/tmp/foreman/vendor/bundle/ruby/3.0.0/gems/rake-13.2.1/lib/rake/application.rb:132:in `top_level'
/tmp/foreman/vendor/bundle/ruby/3.0.0/gems/railties-6.1.7.7/lib/rails/commands/rake/rake_command.rb:24:in `block (2 levels) in perform'
/tmp/foreman/vendor/bundle/ruby/3.0.0/gems/rake-13.2.1/lib/rake/application.rb:214:in `standard_exception_handling'
/tmp/foreman/vendor/bundle/ruby/3.0.0/gems/railties-6.1.7.7/lib/rails/commands/rake/rake_command.rb:24:in `block in perform'
/tmp/foreman/vendor/bundle/ruby/3.0.0/gems/rake-13.2.1/lib/rake/rake_module.rb:59:in `with_application'
/tmp/foreman/vendor/bundle/ruby/3.0.0/gems/railties-6.1.7.7/lib/rails/commands/rake/rake_command.rb:18:in `perform'
/tmp/foreman/vendor/bundle/ruby/3.0.0/gems/railties-6.1.7.7/lib/rails/command.rb:50:in `invoke'
/tmp/foreman/vendor/bundle/ruby/3.0.0/gems/railties-6.1.7.7/lib/rails/commands.rb:18:in `<top (required)>'
/tmp/foreman/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.7.7/lib/active_support/dependencies.rb:332:in `require'
/tmp/foreman/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.7.7/lib/active_support/dependencies.rb:332:in `block in require'
/tmp/foreman/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.7.7/lib/active_support/dependencies.rb:299:in `load_dependency'
/tmp/foreman/vendor/bundle/ruby/3.0.0/gems/activesupport-6.1.7.7/lib/active_support/dependencies.rb:332:in `require'
/tmp/foreman/bin/rails:9:in `<top (required)>'
/tmp/foreman/vendor/bundle/ruby/3.0.0/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `load'
/tmp/foreman/vendor/bundle/ruby/3.0.0/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `call'
/tmp/foreman/vendor/bundle/ruby/3.0.0/gems/spring-2.1.1/lib/spring/client/command.rb:7:in `call'
/tmp/foreman/vendor/bundle/ruby/3.0.0/gems/spring-2.1.1/lib/spring/client.rb:30:in `run'
/tmp/foreman/vendor/bundle/ruby/3.0.0/gems/spring-2.1.1/bin/spring:49:in `<top (required)>'
/tmp/foreman/vendor/bundle/ruby/3.0.0/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `load'
/tmp/foreman/vendor/bundle/ruby/3.0.0/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `<top (required)>'
/tmp/foreman/bin/spring:13:in `require'
/tmp/foreman/bin/spring:13:in `<top (required)>'
Tasks: TOP => snapshots:generate
(See full trace by running task with --trace)

@m-bucher
Copy link
Contributor

m-bucher commented Apr 9, 2024

No clue why it still won't work for you.

But, I think the remaining test-error is 'valid', because for the failing test-case (RHEL9) it should add the rhsm-command but currently does not.
IMHO this is because the test-host used to render the template defines the operatingsystem-name as RHEL and not as RedHat, which you test for in use_rhsm.

If RedHat is the correct name you need to adapt the factory-definition. Otherwise, your check in the kickstart-template must be adapted.

@jcpunk
Copy link
Contributor Author

jcpunk commented Apr 9, 2024

I've just now added an or condition for RHEL. My live RHEL systems all report the OS name as RedHat so I've left that in place.

I don't know why the factory uses RHEL and I'm a bit worried about breaking something else if I change it...

I feel like somewhere in there should be a template that runs the subscription-manager snippet on CentOS Stream9 or the AltLinux distro from the tests, but I don't know how to add/generate that.

@m-bucher
Copy link
Contributor

m-bucher commented Apr 9, 2024

Tests are green 👍
@stejskalleos would you have another look at it?

@jcpunk
Copy link
Contributor Author

jcpunk commented Apr 9, 2024

I am worried that there isn't an explicit test for non-RHEL systems >9.0

@stejskalleos
Copy link
Contributor

I am worried that there isn't an explicit test for non-RHEL systems >9.0

#10121

@stejskalleos
Copy link
Contributor

Changes LGTM, I'll ping our QAs for final verification

ShimShtein
ShimShtein previously approved these changes Apr 14, 2024
Copy link
Member

@ShimShtein ShimShtein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not tested, but code-wise LGTM

@stejskalleos
Copy link
Contributor

Hi, #10121 has been merged, so if you rebase over latest develop and run the snapshots:generate task, you'll get snapshots for Rocky {8,9} as well.

@jcpunk
Copy link
Contributor Author

jcpunk commented Apr 16, 2024

Rebased, but the snippet doesn't seem to fire off with content...

I may have sorted the snippets out

@stejskalleos
Copy link
Contributor

[test integration]

Copy link
Contributor

@stejskalleos stejskalleos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🍏
Everything is green, and the snapshots are OK. Let's get this in.

Thanks @jcpunk and everyone for the help.

@stejskalleos stejskalleos merged commit bf03a25 into theforeman:develop Apr 17, 2024
40 checks passed
@jcpunk jcpunk deleted the rhsm-non-rhel branch April 17, 2024 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants