Bug #25107
closedCannot render PXEGrub2 template using Build PXE Default button
Description
I have associated the "Kickstart default PXEGrub2" with CentOS 7.5. I want to rebuild the default files after a recent upgrade from 1.15 --> 1.18. However, I receive the error:
"undefined method `#operatingsystem' for NilClass:Jail (NilClass) (PXEGrub2)."
Here is a log snippet:
2018-10-02T10:23:47 [W|app|b6fe2] Cannot render 'Kickstart default PXEGrub2' | Safemode::NoMethodError: undefined method '#operatingsystem' for NilClass::Jail (NilClass) | /opt/theforeman/tfm/root/usr/share/gems/gems/safemode-1.3.5/lib/safemode/jail.rb:22:in `method_missing' | Unnamed:55:in `bind' | /opt/theforeman/tfm/root/usr/share/gems/gems/safemode-1.3.5/lib/safemode.rb:51:in `eval' | /opt/theforeman/tfm/root/usr/share/gems/gems/safemode-1.3.5/lib/safemode.rb:51:in `eval' | /usr/share/foreman/lib/foreman/renderer.rb:128:in `render_safe' | /usr/share/foreman/app/models/provisioning_template.rb:161:in `block in build_pxe_default' | /usr/share/foreman/app/models/provisioning_template.rb:153:in `each' | /usr/share/foreman/app/models/provisioning_template.rb:153:in `build_pxe_default'
It seems to be failing on the defined variables "mac" and "major".
<%
major = @host.operatingsystem.major.to_i
mac = @host.provision_interface.mac
- Tell Anaconda to perform network functions with boot interface
- both current and legacy syntax provided
options = ["network", "ksdevice=bootif", "ks.device=bootif"]
if mac
bootif = '00-' + mac.gsub(':', '-')
options.push("BOOTIF=#{bootif}")
end
.....
The @host should tell foreman to request the host's operating system and mac but it seems to fail looking those values up. If I replace the @host.operatingsystem.major.to_i with @osver is seems to get past that but fails on @host.provision_interface.mac. I can seem to find an equivalent replacement for that value.
Any thoughts would be appreciated.