Bug 1941443

Summary: Hypervisor task failed with NoMethodError: undefined method `split' for nil:NilClass
Product: Red Hat Satellite Reporter: Hao Chang Yu <hyu>
Component: Virt-who Configure PluginAssignee: Marek Hulan <mhulan>
Status: CLOSED ERRATA QA Contact: Kunxin Huang <kuhuang>
Severity: medium Docs Contact: satellite-doc-list
Priority: high    
Version: 6.8.0CC: ahumbe, ehelms, hsun, inecas, mhulan, yuefliu
Target Milestone: 6.10.0Keywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-11-16 14:10:29 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:
Embargoed:

Description Hao Chang Yu 2021-03-22 06:43:32 UTC
Description of problem:
When a RHEL based hypervisor is also registered to the Satellite or for any reason that a hypervisor has operating system set. The hypervisor task will fail with the following error:

------------------------------------------------------------
Error:
NoMethodError
undefined method `split' for nil:NilClass
---
- "/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.16.0.11/app/models/katello/host/subscription_facet.rb:228:in
  `ignore_os?'"
- "/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.16.0.11/app/models/katello/host/subscription_facet.rb:215:in
  `update_facts'"
- "/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.16.0.11/app/lib/actions/katello/host/hypervisors_update.rb:179:in
  `update_facts'"
- "/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.16.0.11/app/lib/actions/katello/host/hypervisors_update.rb:32:in
  `block (2 levels) in run'"
- "/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.16.0.11/app/lib/actions/katello/host/hypervisors_update.rb:31:in
  `each'"
- "/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.16.0.11/app/lib/actions/katello/host/hypervisors_update.rb:31:in
  `block in run'"
- "/usr/share/foreman/app/models/concerns/foreman/thread_session.rb:108:in `as'"
- "/usr/share/foreman/app/models/concerns/foreman/thread_session.rb:114:in `as_anonymous_admin'"
- "/opt/theforeman/tfm/root/usr/share/gems/gems/katello-3.16.0.11/app/lib/actions/katello/host/hypervisors_update.rb:18:in
  `run'"
- "/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.7/lib/dynflow/action.rb:571:in
  `block (3 levels) in execute_run'"
- "/opt/theforeman/tfm/root/usr/share/gems/gems/dynflow-1.4.7/lib/dynflow/middleware/stack.rb:27:in
  `pass'"
------------------------------------------------------------

This is because virt-who doesn't report the operating system facts of the hypervisor but Satellite is expecting it.

Steps to Reproduce:
1. Prepare a host running libvirt and register the host to the Satellite.
2. On Satellite, add the virt-who config for this host and deploy the config.
3. Then run "virt-who -do"

Actual results:
Error:
NoMethodError
undefined method `split' for nil:NilClass

Expected results:
Hypvervisor task finishes without error

Comment 1 Bryan Kearney 2021-03-31 16:02:42 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/32150 has been resolved.

Comment 2 Kunxin Huang 2021-06-09 10:05:44 UTC
Verified this issue with Snap6.10_3.0:

Steps:
1. Prepare a host running libvirt and register the host to the Satellite.
2. On Satellite, add the virt-who config for this host and deploy the config.
3. Then run "virt-who -do"

Result:

-------------
[root@ent-02-vm-02 virt-who.d]# hammer task show --id 615ac194-f0d3-4944-a288-3a1f9ec9fd44
ID:          615ac194-f0d3-4944-a288-3a1f9ec9fd44
Action:      Hypervisors 
State:       stopped
Result:      success
Started at:  2021/06/09 10:00:49
Ended at:    2021/06/09 10:00:50
Owner:       virt_who_reporter_64
Task errors:

[root@ent-02-vm-02 virt-who.d]# 
------------

Hypvervisor task finishes without error

Comment 5 errata-xmlrpc 2021-11-16 14:10:29 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 (Moderate: Satellite 6.10 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.

https://access.redhat.com/errata/RHSA-2021:4702