Bug 1736809

Summary: undefined method `split' for nil:NilClass when viewing the host info with hammer
Product: Red Hat Satellite Reporter: matt jia <mjia>
Component: HostsAssignee: Tomer Brisker <tbrisker>
Status: CLOSED ERRATA QA Contact: tstrych
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.5.0CC: egolov, inecas, jscheibe, mmccune, msunil, rbertolj, tbrisker, vmeghana, wlehman
Target Milestone: 6.8.0Keywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Fixed In Version: foreman-2.0.0 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1851134 (view as bug list) Environment:
Last Closed: 2020-10-27 12:58:49 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description matt jia 2019-08-02 05:45:13 UTC
Description of problem:

hammer -u admin -p redhat host info --name=example.com failed with below error found in the production.log

ActionView::Template::Error: undefined method `split' for nil:NilClass
/usr/share/foreman/app/models/nic/base.rb:90:in `type_name'
/usr/share/foreman/app/views/api/v2/interfaces/main.json.rabl:9:in `block in eval_source'
/opt/theforeman/tfm/root/usr/share/gems/gems/rabl-0.13.1/lib/rabl/builder.rb:152:in `node'
/opt/theforeman/tfm/root/usr/share/gems/gems/rabl-0.13.1/lib/rabl/builder.rb:114:in `block in compile_settings'
/opt/theforeman/tfm/root/usr/share/gems/gems/rabl-0.13.1/lib/rabl/builder.rb:113:in `each'

This is due to one interface on the host is having nil type. However, this is working in 6.4 so it seems like a regression..

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


How reproducible:


Steps to Reproduce:
1. hack the db to update an interface's type to nil
2. use hammer to list host info

Actual results:

Hammer command doesn't work and same as the WebUI.

Expected results:

Both hammer and WebUI should work.

Additional info:

We have a KCS for this issue. However, I think satellite should be smart enough to use the default type for an interface with nil type..

Comment 7 Tomer Brisker 2019-12-24 08:31:31 UTC
Created redmine issue https://projects.theforeman.org/issues/28563 from this bug

Comment 8 Bryan Kearney 2019-12-24 09:05:17 UTC
Upstream bug assigned to tbrisker@redhat.com

Comment 9 Bryan Kearney 2019-12-24 09:05:20 UTC
Upstream bug assigned to tbrisker@redhat.com

Comment 10 Bryan Kearney 2019-12-24 17:05:11 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/28563 has been resolved.

Comment 13 tstrych 2020-06-19 16:51:59 UTC

Tried on sat 6.6 with foreman- and were able to successfully reproduce this bug. 
Afterwards I did same process with sat 6.8 snap 5 with foreman-2.1.0-0.20 there is no error on hammer host info --name/--id <host name/id>.

The process steps:
0. (prerequisite) at least 1 host
1. in database, find the host you going to work with, change type of host interface to nil, (tip is to look at host interface before you do that, so you can change it backwards after you try it) 
2. hammer host info on host used in step 1

Comment 16 errata-xmlrpc 2020-10-27 12:58:49 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 (Important: Satellite 6.8 release), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.