After Satellite 6.4 to 6.5 upgrade, "Something went wrong when retrieving the resource" when trying to view some Content Hosts.
Environment
- Red Hat Satellite 6.5
- Red Hat Satellite 6.6
Issue
- After upgrading from
Satellite 6.4toSatellite 6.5successfully, seeing the below error when trying to view someContent Hosts:-
Something went wrong when retrieving the resource.
- The
production.logshows the below error followed by a traceback :-
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'
Resolution
IMPORTANT: Take a snapshot of the Satellite VM before making any of the following changes.
-
The
NICinformation for some of the Content Hosts is missing after the upgrade, and this needs to be rectified. -
Execute the below command on the Satellite :-
# foreman-rake console
> Nic::Base.where(:type => ['Nic::Base', nil]).map{|i| i.update_column(:type, "Nic::Managed")}
> exit
For more KB articles/solutions related to Red Hat Satellite 6.x Installation/Upgrade/Update Issues, please refer to the Red Hat Satellite Consolidated Troubleshooting Article for Red Hat Satellite 6.x Installation/Upgrade/Update Issues.
Root Cause
- The Content Hosts for which the error is seen has been missing the NIC information.
Diagnostic Steps
- The
/var/log/foreman/production.logfile contains the detailed traceback which includes one of the Host IDs for which the NIC information is missing.
E.g. In the below tracback the host with ID108is one of the problematic hosts :-
Processing by Api::V2::HostsController#show as JSON
[I|app|f228c819] Parameters: {"apiv"=>"v2", "id"=>"108"}
2019-07-03T08:04:51 [I|app|] Started GET "/layouts/two-column-details.html" for <IP> at 2019-07-03 08:04:51 -0700
2019-07-03T08:04:51 [I|app|f228c819] Rendered api/v2/hosts/show.json.rabl (160.8ms)
2019-07-03T08:04:51 [W|app|f228c819] Action failed
ActionView::Template::Error: undefined method `split' for nil:NilClass
- Trying to view the host information with
hammertoo results in the same error :-
# hammer host info --id=108
undefined method `split' for nil:NilClass
- List the NIC information for all the hosts with the below command, and check for the host with ID
108:-
# echo "Nic::Base.pluck(:host_id, :type, :name)" >> query; foreman-rake console < query > interfaces.txt ; rm -rf query
The non-problematic hosts appear as :-
[190, "Nic::Managed", "<hostname_1>"]
The problematic hosts appear as :-
[180, nil, "<hostname_2>"]
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.