Bug 1597968 - Provisioning a new host with bond interface without domain and subnet failed with undefined method `vlanid' for nil:NilClass
Summary: Provisioning a new host with bond interface without domain and subnet failed ...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite 6
Classification: Red Hat
Component: Provisioning Templates
Version: 6.3.2
Hardware: All
OS: Linux
unspecified
medium vote
Target Milestone: Released
Assignee: satellite6-bugs
QA Contact: Roman Plevka
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-07-04 04:46 UTC by Varatharaja Perumal G
Modified: 2019-10-07 17:20 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-05-14 12:37:33 UTC


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2019:1222 None None None 2019-05-14 12:37:41 UTC
Foreman Issue Tracker 24151 None None None 2018-07-05 04:45:22 UTC

Description Varatharaja Perumal G 2018-07-04 04:46:03 UTC
Description of problem:

Provisioning a new host with bond interface without domain and subnet failed with undefined method `vlanid' for nil:NilClass

Error when we try to render the Provisioning template:

"There was an error rendering the Satellite Kickstart Default template: ERF42-7327 [Foreman::Exception]: The snippet 'kickstart_ifcfg_generic_interface' threw an error: undefined method `vlanid' for nil:NilClass"

Version-Release number of selected component (if applicable):

Satellite 6.3

How reproducible:


Steps to Reproduce:
1. Create host with three interface eth0, eth1 and eth2
2. eth0 will be managed, provisioning, primary and REX
3. Configure eth1 and eth2 as a managed interface.
4. Configure a managed bond0 interface with eth1 and eth2 as a slave without Subnet, Domain.
5. Once host created try to render the provisioning template of the host.

Actual results:

Provisioning template failed with below error.

"There was an error rendering the Satellite Kickstart Default template: ERF42-7327 [Foreman::Exception]: The snippet 'kickstart_ifcfg_generic_interface' threw an error: undefined method `vlanid' for nil:NilClass"

Expected results:

The host should be provisioned successfully.

Additional info:

Bond interface is considered as virtual so it's looking for a vlanid to tag VLAN information on bond0 interface as per the template.


Template: 'kickstart_ifcfg_generic_interface'
~~~
<%- if @interface.virtual? && ((!@subnet.nil? && @subnet.has_vlanid?) || @interface.vlanid.present?) -%>
<%=   "VLAN=yes" %>
~~~~

Modify the template as below helps to resolve the issue.

~~~
<%- if @interface.virtual? && (!@subnet.nil? && (@subnet.has_vlanid? || @interface.vlanid.present?)) -%>
<%=   "VLAN=yes" %>
~~~

Foreman production log trace:

~~~
2018-07-03 05:39:40 0f1f8e82 [app] [W] Error rendering the Satellite Kickstart Default template
 | Foreman::Exception: ERF42-7327 [Foreman::Exception]: The snippet 'kickstart_ifcfg_generic_interface' threw an error: undefined method `vlanid' for nil:NilClass
 | /usr/share/foreman/app/models/nic/interface.rb:26:in `vlanid'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/safemode-1.3.2/lib/safemode/jail.rb:31:in `method_missing'
 | kickstart_ifcfg_generic_interface:116:in `bind'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/safemode-1.3.2/lib/safemode.rb:51:in `eval'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/safemode-1.3.2/lib/safemode.rb:51:in `eval'
 | /usr/share/foreman/lib/foreman/renderer.rb:56:in `render_safe'
 | /usr/share/foreman/lib/foreman/renderer.rb:175:in `unattended_render'
 | /usr/share/foreman/lib/foreman/renderer.rb:121:in `snippet'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/safemode-1.3.2/lib/safemode/scope.rb:37:in `method_missing'
 | kickstart_ifcfg_bond_interface:52:in `bind'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/safemode-1.3.2/lib/safemode.rb:51:in `eval'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/safemode-1.3.2/lib/safemode.rb:51:in `eval'
 | /usr/share/foreman/lib/foreman/renderer.rb:56:in `render_safe'
 | /usr/share/foreman/lib/foreman/renderer.rb:175:in `unattended_render'
 | /usr/share/foreman/lib/foreman/renderer.rb:121:in `snippet'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/safemode-1.3.2/lib/safemode/scope.rb:37:in `method_missing'
 | kickstart_networking_setup:58:in `block in bind'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/relation/delegation.rb:46:in `each'
 | /opt/rh/rh-ror42/root/usr/share/gems/gems/activerecord-4.2.6/lib/active_record/relation/delegation.rb:46:in `each'
 | /opt/theforeman/tfm/root/usr/share/gems/gems/safemode-1.3.2/lib/safemode/jail.rb:31:in `method_missing'
 | kickstart_networking_setup:53:in `bind'
~~~

Comment 2 pm-sat@redhat.com 2018-08-16 22:14:22 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/24151 has been resolved.

Comment 5 Roman Plevka 2019-03-21 14:56:33 UTC
VERIFIED
on sat6.5.0 snap #20

- i created an atomic host on libvirt, added eth0 as the primary and provisioning interface, and eth1 and eth2 managed interfaces bleonging to the same subnet and domain.
The i created a bond0 interface of bond type and specified eth1,eth2 for the slave devices (it did not belong to any subnet or domain).

then I rendered the Provision template for the host using the "review" button.

the template rendered correctly with no errors thrown.

Comment 7 errata-xmlrpc 2019-05-14 12:37:33 UTC
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/RHSA-2019:1222


Note You need to log in before you can comment on or make changes to this bug.