Hide Forgot
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:
TRIAGE NOTES: I don't think this is high-priority or blocker, easy workaround of associating any PXELinux template.
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'
Upstream bug assigned to lzap
Upstream bug component is Orchestration
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.
Moving to POST since upstream bug http://projects.theforeman.org/issues/14521 has been closed ------------- Lukas Zapletal Applied in changeset commit:c7bb92a96c0ce8f8a9f6a3c4f2ce0bf95a73f459.
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
(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]
Created attachment 1159981 [details] both error messages displayed
I don't see the upstream patch to be present: https://github.com/theforeman/foreman/pull/3402/files
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.
Moving to verified since showing both messages is apparently by design.
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