Bug #19547
closed'kickstart_ifcfg_generic_interface' threw an error: undefined method '#gateway' for NilClass::Jail (NilClass)
Description
with a clean Foreman 1.15 install and database with puppet 4, defining an IPV4 subnet and using the kickstart_default template a host successfully builds the host checks in from puppet, and populates an IPV6 onto the interface,
This can be seen in the host details interface of foreman once the host has checked in IPv6 Address is displayed in this example fe80::dacb:8aff:fee3:2950 however other test cases show they all start with fe80 which is the IPV6 link-local address.
Once this has happened, the template kickstart_networking_setup breaks when you ask it to render for the host with the error.
emplate: ERF42-7327 [Foreman::Exception]: The snippet 'kickstart_ifcfg_generic_interface' threw an error: undefined method '#gateway' for NilClass::Jail (NilClass)
Upon investigation it appears this is because it's checking for a IPV6 gateway for the IPV6 address it's now aware of after the puppet checkin. The Link local address would never have a gateway.
This issue appears to have been addressed in a earlier version of foreman https://github.com/theforeman/foreman/pull/4439
Looking at commit https://github.com/theforeman/foreman/pull/4439/commits/9e74056dff2bc2ac21f2d51c272238edeccba34a the fix in app/models/host/base.rb appears to have been lost in the re-write for 1.15
I've been unable to find if this is now handled elsewhere or if I'm looking at this wrong, however it looks like this is a regression of an earlier problem.
It appears the problem is that foreman should not be aware of this iP from facts, but there maybe worth in looking at this as a second issue in that the template could also be used to ignore this.
Updated by Dominic Cleal over 7 years ago
- Related to Bug #17895: Foreman stores link local IPv6 address added
Updated by Dominic Cleal over 7 years ago
- Category changed from Facts to Templates
I think #17895 (which is not in 1.15.0) will fix the fact import problem, so this is probably a duplicate of that ticket. I will leave this against the template instead which could handle @subnet6
being nil to prevent the nilclass gateway error.
Updated by Dominic Cleal over 7 years ago
- Subject changed from Foreman 1.15 treads IPV6 link local address as valid IPV6 IP address and breaks template kickstart_networking_setup to 'kickstart_ifcfg_generic_interface' threw an error: undefined method '#gateway' for NilClass::Jail (NilClass)
Updated by Matt Darcy over 7 years ago
I didn't realise 17895 was not in 1.15 - so that would make sense to fix it that way, and I appreciate leaving this open as a template bug as handling it via the template as well would be a nice clean solution.
Updated by Anonymous over 7 years ago
- Is duplicate of Bug #19608: kickstart_ifcfg_generic_interface template is broken added