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 1324469 - Unable to provision host without PXELinux template
Summary: Unable to provision host without PXELinux template
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Orchestration
Version: 6.2.0
Hardware: Unspecified
OS: Unspecified
unspecified
low
Target Milestone: Unspecified
Assignee: Lukas Zapletal
QA Contact: Roman Plevka
URL: http://projects.theforeman.org/issues...
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-04-06 12:05 UTC by Roman Plevka
Modified: 2019-09-26 16:21 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-07-27 11:10:25 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
both error messages displayed (14.14 KB, image/png)
2016-05-20 15:18 UTC, Roman Plevka
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 14521 0 Normal Closed TFTP orchestration fails for OS with iPXE w/o PXELinux associated 2020-06-04 10:22:23 UTC

Description Roman Plevka 2016-04-06 12:05:37 UTC
Description of problem:
I wanted to provision a host on libvirt CR without PXELinux template (as libvirt guest machines already support iPXE). So i disassociated my OS from the PXELinux template. While creating a Host, the provsioning templates are correctly being resolved showing only:

finish Template Katello Kickstart Default Finish
iPXE Template Kickstart default iPXE
provision Template Katello Kickstart Default
user_data Template Katello Kickstart Default User Data

When I click submit I end up with error:
"Failed to generate PXELinux template: undefined method `encoding' for nil:NilClass"


Version-Release number of selected component (if applicable):
6.2.0 snap6.1

How reproducible:
always

Steps to Reproduce:
1. disassociate your OS from all PXELinux-type templates
2. Go to Operating Systems and make sure there's no PXELinux template field in the Templates tab of your OS
3. Create new host - make sure "Resolving Provisioning Templates" returns only the ones listed above (no PXELinux template)
4. Submit the form to start host provisioning.


Actual results:
"Failed to generate PXELinux template: undefined method `encoding' for nil:NilClass"

Expected results:
Host created/provisioned just fine

Additional info:

Comment 2 Lukas Zapletal 2016-04-06 12:50:45 UTC
TRIAGE NOTES: I don't think this is high-priority or blocker, easy workaround of associating any PXELinux template.

Comment 3 Lukas Zapletal 2016-04-07 09:56:57 UTC
Reproduced, we need to prevent from running TFTP orchestration.

2016-04-07 05:07:28 [app] [W] Failed to generate PXELinux template: undefined method `encoding' for nil:NilClass
 | NoMethodError: undefined method `encoding' for nil:NilClass
 | /opt/rh/rh-ruby22/root/usr/share/ruby/erb.rb:598:in `compile'
 | /opt/rh/rh-ruby22/root/usr/share/ruby/erb.rb:800:in `initialize'
 | /usr/share/foreman/lib/foreman/renderer.rb:16:in `new'
 | /usr/share/foreman/lib/foreman/renderer.rb:16:in `render_safe'
 | /usr/share/foreman/lib/foreman/renderer.rb:103:in `unattended_render'
 | /usr/share/foreman/app/models/concerns/orchestration/tftp.rb:45:in `generate_pxe_template'
 | /usr/share/foreman/app/models/concerns/orchestration/tftp.rb:63:in `setTFTP'
 | /usr/share/foreman/app/models/concerns/orchestration.rb:162:in `execute'
 | /usr/share/foreman/app/models/concerns/orchestration.rb:107:in `block in process'
 | /usr/share/foreman/app/models/concerns/orchestration.rb:99:in `each'
 | /usr/share/foreman/app/models/concerns/orchestration.rb:99:in `process'
 | /usr/share/foreman/app/models/concerns/orchestration.rb:35:in `on_save'

Comment 4 Bryan Kearney 2016-04-07 10:11:01 UTC
Upstream bug assigned to lzap

Comment 5 Bryan Kearney 2016-04-07 10:11:04 UTC
Upstream bug component is Orchestration

Comment 6 Lukas Zapletal 2016-04-07 12:00:33 UTC
For the record, this bug is only relevant in scenario when your OS *has* iPXE template associated but *has not* PXELinux template assicociate. If there is no iPXE, then we raise a proper error: "No %{template_kind} templates were found for this host, make sure you define at least one in your %{os} settings".

Before you verify, read the resolution in the upstream ticket. We are likely only to change the message to something better.

Comment 8 Bryan Kearney 2016-04-12 14:11:26 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/14521 has been closed
-------------
Lukas Zapletal
Applied in changeset commit:c7bb92a96c0ce8f8a9f6a3c4f2ce0bf95a73f459.

Comment 10 Lukas Zapletal 2016-05-16 09:57:34 UTC
I get your point, but we don't know that the host was created on libvirt. This part of Foreman must work in general, so I made a patch that gets rid of the ugly error "undefined method `encoding' for nil:NilClass" replacing it with a proper one. You need to associate at least PXELinux template.

For 6.3+ we will redesign PXE templates for UEFI support, I will consider an option to be able to avoid this behavior: https://github.com/theforeman/rfcs/pull/2#issuecomment-219390164

Comment 11 Roman Plevka 2016-05-20 15:17:19 UTC
(In reply to Lukas Zapletal from comment #10)
> I get your point, but we don't know that the host was created on libvirt.
> This part of Foreman must work in general, so I made a patch that gets rid
> of the ugly error "undefined method `encoding' for nil:NilClass" replacing
> it with a proper one. You need to associate at least PXELinux template.
> 
> For 6.3+ we will redesign PXE templates for UEFI support, I will consider an
> option to be able to avoid this behavior:
> https://github.com/theforeman/rfcs/pull/2#issuecomment-219390164

FAILEDQA:
This fix actually adds not message leaving the 'ugly' one still in place instead of replacing it. Could you tweak it more, please? [screenshot attached]

Comment 12 Roman Plevka 2016-05-20 15:18:16 UTC
Created attachment 1159981 [details]
both error messages displayed

Comment 13 Lukas Zapletal 2016-05-23 14:33:17 UTC
I don't see the upstream patch to be present:

https://github.com/theforeman/foreman/pull/3402/files

Comment 16 Lukas Zapletal 2016-06-07 12:41:25 UTC
I think the error message (see comment 12 screenshot) is clear enough. Compare to previous state which was only "Failed to generate PXELinux template: undefined method `encoding' for nil:NilClass". Now you see what's wrong and how to fix it.

Since we are redesigning TFTP orchestration for UEFI right now, I think this is not worth any other effort for 6.2. Required templates will be driven from TFTP flag that will be associated with host now (new feature).

Let's just waive it for 6.2. Workaround is obvious - either associate PXELinux template with our OS or don't associate TFTP Capsule for the whole subnet so TFTP orchestration is skipped.

Comment 19 Roman Plevka 2016-06-14 12:14:31 UTC
Moving to verified since showing both messages is apparently by design.

Comment 20 Bryan Kearney 2016-07-27 11:10:25 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2016:1501


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