The snippet 'subscription_manager_setup' threw an error: undefined method '#rhsm_url'

Problem:
After upgrading from Foreman 3.8/Katello 4.10 to Foreman 3.9/Katello 4.11, when pxebooting a RHEL8 server, the installation errors out with “anaconda: failed to fetch kickstart from http:///unattended/provision?staic=1&token=xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx”

Expected outcome:
I expect the kickstart to work.

Foreman and Proxy versions:

  • candlepin-4.3.12-1.el8.noarch
  • candlepin-selinux-4.3.12-1.el8.noarch
  • foreman-3.9.3-1.el8.noarch
  • foreman-cli-3.9.3-1.el8.noarch
  • foreman-debug-3.9.3-1.el8.noarch
  • foreman-dynflow-sidekiq-3.9.3-1.el8.noarch
  • foreman-installer-3.9.3-1.el8.noarch
  • foreman-installer-katello-3.9.3-1.el8.noarch
  • foreman-obsolete-packages-1.6-1.el8.noarch
  • foreman-postgresql-3.9.3-1.el8.noarch
  • foreman-proxy-3.9.3-1.el8.noarch
  • foreman-redis-3.9.3-1.el8.noarch
  • foreman-selinux-3.9.3-1.el8.noarch
  • foreman-service-3.9.3-1.el8.noarch
  • katello-4.11.1-1.el8.noarch
  • katello-ca-consumer-acilformn001.local.net-1.0-2.noarch
  • katello-certs-tools-2.9.0-2.el8.noarch
  • katello-client-bootstrap-1.7.9-2.el8.noarch
  • katello-common-4.11.1-1.el8.noarch
  • katello-debug-4.11.1-1.el8.noarch
  • katello-selinux-5.0.2-1.el8.noarch
  • pulpcore-obsolete-packages-1.0-9.el8.noarch
  • pulpcore-selinux-2.0.1-1.el8.x86_64
  • python3.11-pulp-ansible-0.20.2-3.el8.noarch
  • python3.11-pulp-certguard-1.7.1-2.el8.noarch
  • python3.11-pulp-cli-0.21.2-5.el8.noarch
  • python3.11-pulp-container-2.16.4-1.el8.noarch
  • python3.11-pulp-deb-3.0.1-1.el8.noarch
  • python3.11-pulp-file-1.15.1-2.el8.noarch
  • python3.11-pulp-glue-0.21.2-3.el8.noarch
  • python3.11-pulp-python-3.10.0-3.el8.noarch
  • python3.11-pulp-rpm-3.23.3-1.el8.noarch
  • python3.11-pulpcore-3.39.11-1.el8.noarch
  • rubygem-foreman-tasks-9.0.4-1.fm3_9.el8.noarch
  • rubygem-foreman_maintain-1.4.4-1.el8.noarch
  • rubygem-foreman_openscap-7.1.1-1.fm3_9.el8.noarch
  • rubygem-foreman_puppet-6.2.0-1.fm3_9.el8.noarch
  • rubygem-foreman_remote_execution-12.0.5-1.fm3_9.el8.noarch
  • rubygem-hammer_cli-3.9.0-1.el8.noarch
  • rubygem-hammer_cli_foreman-3.9.0-1.el8.noarch
  • rubygem-hammer_cli_foreman_puppet-0.0.7-1.fm3_9.el8.noarch
  • rubygem-hammer_cli_foreman_remote_execution-0.3.0-1.fm3_9.el8.noarch
  • rubygem-hammer_cli_foreman_tasks-0.0.20-1.fm3_9.el8.noarch
  • rubygem-hammer_cli_katello-1.11.2-1.el8.noarch
  • rubygem-katello-4.11.1-1.el8.noarch
  • rubygem-pulp_ansible_client-0.20.2-1.el8.noarch
  • rubygem-pulp_certguard_client-1.6.5-1.el8.noarch
  • rubygem-pulp_container_client-2.16.2-1.el8.noarch
  • rubygem-pulp_deb_client-3.0.0-1.el8.noarch
  • rubygem-pulp_file_client-1.15.1-1.el8.noarch
  • rubygem-pulp_ostree_client-2.1.3-1.el8.noarch
  • rubygem-pulp_python_client-3.10.0-1.el8.noarch
  • rubygem-pulp_rpm_client-3.23.0-1.el8.noarch
  • rubygem-pulpcore_client-3.39.2-1.el8.noarch
  • rubygem-smart_proxy_pulp-3.2.0-3.fm3_9.el8.noarch

Foreman and Proxy plugin versions:

Distribution and version:
Red Hat Enterprise Linux 8.9

Other relevant data:
This was in /var/log/foreman/production.log

2024-05-09T12:24:18 [I|app|f17b44a2] Backtrace for ‘Error while rendering a snippet’ error (Foreman::Exception): ERF42-7327 [Foreman::Exception]: The snippet ‘subscription_manager_setup’ threw an error: undefined method ‘#rhsm_url’ for NilClass::Jail (NilClass)

Here is the complete error message.

2024-05-09T15:55:51 [E|app|a7510e88] There was an error rendering the Kickstart default template: ERF42-7327 [Foreman::Exception]: The snippet ‘subscription_manager_setup’ threw an error: undefined method ‘#rhsm_url’ for NilClass::Jail (NilClass)
2024-05-09T15:55:51 [I|app|a7510e88] Rendered text template (Duration: 0.0ms | Allocations: 1)
2024-05-09T15:55:51 [I|app|a7510e88] Completed 500 Internal Server Error in 638ms (Views: 0.3ms | ActiveRecord: 67.8ms | Allocations: 281974)
2024-05-09T15:55:52 [I|app|ba8cb8b3] Started GET “/notification_recipients” for 192.168.31.1 at 2024-05-09 15:55:52 +0000
2024-05-09T15:55:52 [I|app|ba8cb8b3] Processing by NotificationRecipientsController#index as JSON
2024-05-09T15:55:52 [I|app|ba8cb8b3] Completed 200 OK in 18ms (Views: 0.2ms | ActiveRecord: 3.8ms | Allocations: 2538)
2024-05-09T15:55:53 [I|app|bebc7ec4] Started GET “/unattended/provision?static=1&token=3e4a48b5-3350-41d4-af4e-8b52921eeb6c” for 192.168.31.108 at 2024-05-09 15:55:53 +0000
2024-05-09T15:55:53 [I|app|bebc7ec4] Processing by UnattendedController#host_template as TEXT
2024-05-09T15:55:53 [I|app|bebc7ec4] Parameters: {“static”=>“1\”, “token”=>“3e4a48b5-3350-41d4-af4e-8b52921eeb6c”, “kind”=>“provision”}
2024-05-09T15:55:54 [W|app|bebc7ec4] Error while rendering a snippet
2024-05-09T15:55:54 [I|app|bebc7ec4] Backtrace for ‘Error while rendering a snippet’ error (Foreman::Exception): ERF42-7327 [Foreman::Exception]: The snippet ‘subscription_manager_setup’ threw an error: undefined method ‘#rhsm_url’ for NilClass::Jail (NilClass)

I’m running into the same / similar issue. I have a katello setup, but since I’m just using the developer RHEL licenses, I’m not actually using katello to manage the subscriptions. I want to us subscrtion-manager to register directly with red hat. I had a locally modified “Kickstart default” and when I swapped back to the standard “Kickstart default” template, it worked better.

Even though it generated an actual kickstart file, it was using a “rhsm” command to try and register, which doesnt exist on my system. I tried to force it to run the older “redhat_register” for RHEL 9, but I’m getting errors again.

I’m still not done figuring it out, but just wanted to see if you also had locally modified templates or were running katello and trying to register directly with redhat to see if we have anything in common.

I have tried registering the foreman server directly with redhat and registering it to itself. Both led me to the same problem. I do not touch the “Kickstart default” prebuilt templates. From what I read when I first built my foreman server, the instruction said not to modify the “Kickstart default” prebuilt templates, but instead use “Kickstart default custom packages”, “Kickstart default custom post”, and “Kickstart default custom postnochroot”. Those 3 are for my setup. I’m sure there are more for other operating systems and setups.

Did any one find a solution to this. It seems like root problem is that something should have been declared in the subscription_manager_setup template or maybe the Global Registration template.

Sounds like, that Contet View, Content Source and/or Lifecycle Environment is not set for the used Host or Hostgroup. Try it works if you set in for the Hostgroup.

That is the first thing I checked. They haven’t changed for 2 years. I will delete them and add them back.

Do they need to be set? Can they not be left empty?

Yes that’s what is was. I forgot that it was a requirement to have a content view to provision even if it is an image provision.

Thanks

1 Like