undefined method `split' for nil:NilClass when viewing the host info with hammer
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/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:114:in `block in compile_settings'
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):
Steps to Reproduce:
1. hack the db to update an interface's type to nil
2. use hammer to list host info
Hammer command doesn't work and same as the WebUI.
Both hammer and WebUI should work.
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..
Fixes #28563 - Be defensive about interface type in API
It appears in some cases interfaces might be registered in the database
with `nil` type. While that is invalid, such interface's existance
causes the host/nic APIs to return an error instead of the requested
This PR makes sure that such interfaces are still displayed in the API.