Bug #19547

'kickstart_ifcfg_generic_interface' threw an error: undefined method '#gateway' for NilClass::Jail (NilClass)

Added by Matt Darcy about 1 year ago. Updated about 1 year ago.

Status:Duplicate
Priority:Normal
Assigned To:-
Category:Templates
Target version:-
Difficulty: Bugzilla link:
Found in release:1.15.0 Pull request:
Story points-
Velocity based estimate-

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.


Related issues

Related to Foreman - Bug #17895: Foreman stores link local IPv6 address Closed 01/02/2017
Duplicates Foreman - Bug #19608: kickstart_ifcfg_generic_interface template is broken Closed 05/19/2017

History

#1 Updated by Dominic Cleal about 1 year ago

  • Related to Bug #17895: Foreman stores link local IPv6 address added

#2 Updated by Dominic Cleal about 1 year 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.

#3 Updated by Dominic Cleal about 1 year 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)

#4 Updated by Matt Darcy about 1 year 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.

#5 Updated by Michael Moll about 1 year ago

  • Duplicates Bug #19608: kickstart_ifcfg_generic_interface template is broken added

#6 Updated by Michael Moll about 1 year ago

  • Status changed from New to Duplicate

Also available in: Atom PDF