This bug has been migrated to another issue tracking site. It has been closed here and may no longer be being monitored.

If you would like to get updates for this issue, or to participate in it, you may do so at Red Hat Issue Tracker .
Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2225129 - Satellite fails to perform kexec as a part of discovery process if no PXELoader is selected for the host profile
Summary: Satellite fails to perform kexec as a part of discovery process if no PXELoad...
Keywords:
Status: CLOSED MIGRATED
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Discovery Plugin
Version: 6.12.4
Hardware: All
OS: All
unspecified
medium
Target Milestone: Unspecified
Assignee: Leos Stejskal
QA Contact: Shweta Singh
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-07-24 11:08 UTC by Sayan Das
Modified: 2024-06-06 16:25 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2024-06-06 16:25:10 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 36626 0 Normal New Template render error when no PXELoader is selected 2023-08-01 06:36:58 UTC
Red Hat Issue Tracker   SAT-19135 0 None Migrated None 2024-06-06 16:25:09 UTC

Description Sayan Das 2023-07-24 11:08:21 UTC
Description of problem:

Satellite fails to perform kexec as a part of the discovery process if no PXELoader is selected for the host profile

Version-Release number of selected component (if applicable):

Satellite 6.12.4 and later


How reproducible:

100%


Steps to Reproduce:

1. Install and configure a Satellite 6.12 for PXELess discovery-based deployment

2. Setup Hostgroups and discovery rules as per https://www.redhat.com/en/blog/provisioning-discovery-rules-red-hat-satellite-6 

3. Ensure that the PXELoader is unselected in the Hostgroup i.e. blank\nil.

4. You can use either Discovery ISO or boot the blank system from network to get the Discovery many and start booting from Discovery 

5. As soon as it shows the message about auto-discovery, hit some key to interrupt the process and then on the next screen, use DHCP or Static discovery options. 

   This interruption will ensure that kexec happens at the end.

6. Monitor the overall process. 



Actual results:

Host is discovered, a new host profile is created and submitted for build but kexec would not be possible due to the following traceback 

~~
2023-07-24T15:55:49 [W|app|75f82e89] Unable render or parse kexec template, must be valid JSON
2023-07-24T15:55:49 [I|app|75f82e89] Backtrace for 'Unable render or parse kexec template, must be valid JSON' error (NoMethodError): undefined method `include?' for nil:NilClass
 75f82e89 | Discovery Red Hat kexec:17:in `get_binding'
 75f82e89 | /usr/share/ruby/erb.rb:905:in `eval'
 75f82e89 | /usr/share/ruby/erb.rb:905:in `result'
 75f82e89 | /usr/share/foreman/app/services/foreman/renderer/unsafe_mode_renderer.rb:7:in `render'
 75f82e89 | /usr/share/foreman/app/services/foreman/renderer/base_renderer.rb:18:in `render'
 75f82e89 | /usr/share/foreman/app/services/foreman/renderer.rb:46:in `render'
 75f82e89 | /usr/share/foreman/app/models/template.rb:172:in `render'
 75f82e89 | /usr/share/foreman/app/models/host/base.rb:348:in `render_template'
 75f82e89 | /usr/share/gems/gems/foreman_discovery-21.0.5/app/models/host/managed_extensions.rb:48:in `render_kexec_template'
 75f82e89 | /usr/share/gems/gems/foreman_discovery-21.0.5/app/models/host/managed_extensions.rb:58:in `setKexec'
 75f82e89 | /usr/share/foreman/app/models/concerns/orchestration.rb:227:in `execute'
~~

Reason: The Hostgroup has no PXE Loader selected and hence Host also inherited a null value but https://github.com/theforeman/foreman/blob/develop/app/views/unattended/provisioning_templates/discovery/redhat_kexec.erb#L48 expects some loader to be selected so that it can search for the "SecureBoot" string. 

  extra << "--kexec-file-syscall" if @host.pxe_loader.include?('SecureBoot')


Expected results:

No such issues. Discovery Kexec should happen even if no PXELoaders are selected. 


Additional info:

We can solve it in two ways:

* Select the PXE Loader as "None" instead of leaving it blank. This allows both LEgacy BIOS and UEFI builds to happen without needing to specify any related loaders for the hostgroup or host.

* [ least preferable option i guess ] 

Change 

  extra << "--kexec-file-syscall" if @host.pxe_loader.include?('SecureBoot')

to

  extra << "--kexec-file-syscall" if @host.pxe_loader && @host.pxe_loader.include?('SecureBoot')


And then leaving the PXELoader blank\unselected will work.

[ But I still prefer to select None instead of this change ]

Comment 7 Leos Stejskal 2023-08-01 06:24:37 UTC
Looking at the issue, there are multiple ways how to fix the issue:
1) Show a warning in the UI that it should not be empty, unless the provisioning method is from an image.
This doesn't solve the issue of the API.
2) @host.pxe_loader should never return nil, always an empty array (best solution IMHO)
3) Documentation update.

And probably some other solutions.

I will create a PR fixing 2. point and let's see if it passes through the review,
then we should update the docs

Comment 8 Leos Stejskal 2023-08-01 06:36:57 UTC
Created redmine issue https://projects.theforeman.org/issues/36626 from this bug

Comment 9 Eric Helms 2024-06-06 16:25:10 UTC
This BZ has been automatically migrated to the issues.redhat.com Red Hat Issue Tracker. All future work related to this report will be managed there.

Due to differences in account names between systems, some fields were not replicated.  Be sure to add yourself to Jira issue's "Watchers" field to continue receiving updates and add others to the "Need Info From" field to continue requesting information.

To find the migrated issue, look in the "Links" section for a direct link to the new issue location. The issue key will have an icon of 2 footprints next to it, and begin with "SAT-" followed by an integer.  You can also find this issue by visiting https://issues.redhat.com/issues/?jql= and searching the "Bugzilla Bug" field for this BZ's number, e.g. a search like:

"Bugzilla Bug" = 1234567

In the event you have trouble locating or viewing this issue, you can file an issue by sending mail to rh-issues. You can also visit https://access.redhat.com/articles/7032570 for general account information.


Note You need to log in before you can comment on or make changes to this bug.