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”.
Here is the relevant template code:
<%
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
…
Foreman and Proxy versions:
Foreman 1.18.1
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.
I have recently upgraded from 1.15.0 --> 1.18.1. Not sure if this would have caused some issues. I’ve setup a clustered environment and have split out the ENC and reports to separate servers. The only change in code was to modify some ruby code so that the reports would go to one server and the ENC requests would go to the other.
Note: I had to remove the ‘@’ sign in front of ‘host’ since the foreman forum does allow more than 2 users to be mentioned and it is interpreting the sign as users.