Bug #28563
closedundefined method `split' for nil:NilClass when viewing the host info with hammer
Description
Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1736809
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):
6.5
How reproducible:
Easy
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..