Bug 2056582

Summary: Ansible parser creates new OS if it runs against RHEL ComputeNode
Product: Red Hat Satellite Reporter: Ondrej Gajdusek <ogajduse>
Component: FactAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED WONTFIX QA Contact: Satellite QE Team <sat-qe-bz-list>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.11.0CC: mhulan
Target Milestone: UnspecifiedKeywords: 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: 2023-04-06 17:10:05 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 Ondrej Gajdusek 2022-02-21 14:23:15 UTC
Description of problem:
If the redhat-lsb-core package is installed on the system and Ansible roles are run on the RHEL ComputeNode host, a new Operating System is created.
This BZ is similar to BZ2025437 but is using a different OS variant to reproduce the behavior. Please see BZ2025437 for more details.

Version-Release number of selected component (if applicable):
@Satellite 7.0.0 snap 9
foreman-3.1.1.4-1.el8sat.noarch
rubygem-foreman_ansible-7.0.2-1.el8sat.noarch

How reproducible:
always

Steps to Reproduce:
1. Register RHEL 7 ComputeNode host to Satellite
2. yum install redhat-lsb-core # on the host
3. Copy capsule SSH pubkey to the host's authorized_keys
4. Run Ansible roles on the host. The host does not have to have roles assigned

Actual results:
New Operating System "Red Hat Enterprise Linux ComputeNode release 7.9 (Maipo)" is created.

Expected results:
No new operating system should be created and the existing RedHat 7.9 should be used. <-- This is a solution, which was used in BZ2025437. I expect the same for all other RHEL variants.

Additional info:
This is not a regression.

See also BZ1676493 which requests the actual behavior.

As there are multiple OS variants, the ideal fix would be to fix this behavior for all RHEL variants across all RHEL versions.

Comment 1 Marek Hulan 2022-02-22 11:55:53 UTC
If I'm not mistaken this whole set of problems appeared because we started to distinguish between the Workstation and Server. That was intended and requested by customers. Doesn't it make sense to actually keep CompueNode as a different OS than e.g. Server? Note that the provisioning template may differ for such OS.

Comment 2 Ondrej Gajdusek 2022-02-22 16:09:36 UTC
I do not track the customer requests, so I do not have the full picture of it. I do not have a strong opinion on keeping ComputeNode as a separate OS. I just care about the consistency of Satellite behavior. The thing is that RHSM reports ComputeNode as RedHat 7.9, but Ansible creates a new OS entity and assigns it to the host on which the roles were run.

Looking at what you have stated in comment1 I suggest reverting the patch you made to the Ansible fact parser and making a new one for RHSM facts parser so it reports the ComputeNode system as ComputeNode, not a RedHat.

Comment 7 Ondrej Gajdusek 2022-04-20 14:29:12 UTC
Register the host to Satellite:
subscription-manager register --org="Default_Organization" --activationkey="ak1"

See the host entity:
# hammer --output yaml host list --search dhcp-2-47.vms.sat.rdu2.redhat.com --fields 'Name,Operating system'
---
- Name: dhcp-2-47.vms.sat.rdu2.redhat.com
  Operating System:
    Name: RedHat 7.9
    Id: 2

List all defined OSes:
hammer --output yaml os list
---
- Id: 2
  Title: RedHat 7.9
  Release name: 
  Family: Redhat
- Id: 1
  Title: RHEL 8.5
  Release name: 
  Family: Redhat

On the host, install redhat-lsb-core package. This is a key step that affects Ansible parser behavior.
# yum install redhat-lsb-core

In the Sat WebUI, run Ansible roles on the host to let Foreman's Ansible parser parse the host facts.

Lookup the host, and see that the assigned OS has changed.
# hammer --output yaml host list --search dhcp-2-47.vms.sat.rdu2.redhat.com --fields 'Name,Operating system'
---
- Name: dhcp-2-47.vms.sat.rdu2.redhat.com
  Operating System:
    Name: Red Hat Enterprise Linux ComputeNode release 7.9 (Maipo)
    Id: 4

List all OSes to see the new OS entity:
# hammer --output yaml os list
---
- Id: 2
  Title: RedHat 7.9
  Release name: 
  Family: Redhat
- Id: 4
  Title: Red Hat Enterprise Linux ComputeNode release 7.9 (Maipo)
  Release name: 
  Family: Redhat
- Id: 1
  Title: RHEL 8.5
  Release name: 
  Family: Redhat
  
On the host, upload the host facts to Satellite so it gets parsed using the RHSM facts parser:
# subscription-manager facts --update
Successfully updated the system facts.

Verify that the assigned OS changed back:
# hammer --output yaml host list --search dhcp-2-47.vms.sat.rdu2.redhat.com --fields 'Name,Operating system'
---
- Name: dhcp-2-47.vms.sat.rdu2.redhat.com
  Operating System:
    Name: RedHat 7.9
    Id: 2
    

Actual behavior:
The OS assigned to the host varies on the facts parser used as well as on the system packages installed. When there is redhat-lsb-core package installed, the Ansible facts parser makes Foreman change the OS of the host. If the host facts get uploaded again using the RHSM facts parser, the host OS changes again.

From the discussion with Marek and per what is stated in BZ1429033 the current behavior is:
Red Hat Enterprise Linux Server 7.9 -> RedHat 7.9 
Red Hat Enterprise Linux Workstation 7.9 -> RedHat_Workstation 7.9

The behavior that was observed in the case of the ComputeNode variant.
Red Hat Enterprise Linux ComputeNode 7.9 -> RedHat 7.9 # without having redhat-lsb-core package installed
Red Hat Enterprise Linux ComputeNode 7.9 -> Red Hat Enterprise Linux ComputeNode release 7.9 (Maipo) # redhat-lsb-core package installed


Expected behavior:
The host should have always the same OS assigned. All fact parsers should always report the same OS no matter the packages installed.

Comment 8 Brad Buckingham 2023-03-06 11:40:19 UTC
Upon review of our valid but aging backlog the Satellite Team has concluded that this Bugzilla does not meet the criteria for a resolution in the near term, and are planning to close in a month. This message may be a repeat of a previous update and the bug is again being considered to be closed. If you have any concerns about this, please contact your Red Hat Account team.  Thank you.

Comment 9 Brad Buckingham 2023-04-06 17:10:05 UTC
Thank you for your interest in Red Hat Satellite. We have evaluated this request, and while we recognize that it is a valid request, we do not expect this to be implemented in the product in the foreseeable future. This is due to other priorities for the product, and not a reflection on the request itself. We are therefore closing this out as WONTFIX. If you have any concerns about this feel free to contact your Red Hat Account Team. Thank you.