Bug 1722238

Summary: subscription-manager on rhel-7 fails to report an insights_id fact
Product: Red Hat Enterprise Linux 7 Reporter: John Sefler <jsefler>
Component: subscription-managerAssignee: Jiri Hnidek <jhnidek>
Status: CLOSED ERRATA QA Contact: Red Hat subscription-manager QE Team <rhsm-qe>
Severity: high Docs Contact:
Priority: high    
Version: 7.7CC: bcourt, cdonnell, csnyder, jhnidek, jomurphy, redakkan
Target Milestone: rcKeywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: subscription-manager-1.24.13-1.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-08-06 12:57:32 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:
Attachments:
Description Flags
insights none

Description John Sefler 2019-06-19 18:36:15 UTC
Description of problem:
The latest version of subscription-manager targeted for rhel-7.7 does not report the insights_id fact when the redhat-access-insights package (or insights-client package) is installed on the rhel-7 system and registered to an insights server.

Refer to https://access.redhat.com/blogs/2184921/posts/3348271 for more information on insights.

The purpose of this bug is to cherry-pick the fix from https://github.com/candlepin/subscription-manager/pull/2097 into the RHEL-7.7 branch of subscription-manager.

This is a proactive bug report in preparation for the work being done by the rhsm-conduit team's contribution to the insights project.


Version-Release number of selected component (if applicable):
subscription-manager-1.24.10-1.el7  <== DOES NOT REPORT AN insights_id FACT

Comment 5 Rehana 2019-06-21 09:00:10 UTC
Verifying on :

# subscription-manager version
server type: This system is currently not registered.
subscription management server: 2.3.17-1
subscription management rules: 5.35
subscription-manager: 1.24.12-1.el7

insights version 
===============
insights-client-3.0.3-9.el7_5.noarch

The following scenario's are tested as part of verification :

Verify the insights facts values, 
1. On a unregistered RHEL7.7  system with NO redhat-access-insights/insights-client rpms installed
2. On a unregistered RHEL7.7  system with redhat-access-insights/insights-client rpms installed
3. On a RHSM registered RHEL7.7  system with NO insights registration 
4. On a RHSM registered RHEL7.7  system with insights registration 


1. On a unregistered RHEL7.7  system with NO redhat-access-insights/insights-client rpms installed
==================================================================================================

# rpm -qa subscription-manager --changelog | grep 1722238
- 1722238: Report insights id as fact, when insights is installed

# subscription-manager facts --list | grep insights

Results : No values collected and NO error message in rhsm.log ===> PASSED

2. On a unregistered RHEL7.7  system with redhat-access-insights/insights-client rpms installed
==================================================================================================

[root@ibm-ls22-01 ~]#  yum install redhat-access-insights
Loaded plugins: product-id, search-disabled-repos, subscription-manager
This system is not registered with an entitlement server. You can use subscription-manager to register.
Resolving Dependencies
--> Running transaction check
---> Package insights-client.noarch 0:3.0.3-9.el7_5 will be installed
--> Processing Dependency: python-requests >= 2.6 for package: insights-client-3.0.3-9.el7_5.noarch
--> Processing Dependency: pciutils for package: insights-client-3.0.3-9.el7_5.noarch
--> Processing Dependency: libcgroup for package: insights-client-3.0.3-9.el7_5.noarch
--> Processing Dependency: PyYAML for package: insights-client-3.0.3-9.el7_5.noarch

<snip>

Installed:
  insights-client.noarch 0:3.0.3-9.el7_5                                                                                                                                                                           

Dependency Installed:
  PyYAML.x86_64 0:3.10-11.el7   libcgroup.x86_64 0:0.41-21.el7   libyaml.x86_64 0:0.1.4-11.el7_0   pciutils.x86_64 0:3.5.1-3.el7   python-requests.noarch 0:2.6.0-5.el7   python-urllib3.noarch 0:1.10.2-7.el7  

Complete!

CHECK THE MACHINE ID FILE 

[root@ibm-ls22-01 ~]# ll /etc/redhat-access-insights/
total 0
lrwxrwxrwx. 1 root root 31 Jun 21 03:46 machine-id -> /etc/insights-client/machine-id
lrwxrwxrwx. 1 root root 41 Jun 21 03:46 redhat-access-insights.conf -> /etc/insights-client/insights-client.conf
lrwxrwxrwx. 1 root root 41 Jun 21 03:46 redhat-access-insights.cron -> /etc/insights-client/insights-client.cron

[root@ibm-ls22-01 ~]# cat /etc/insights-client/machine-id
cat: /etc/insights-client/machine-id: No such file or directory
[root@ibm-ls22-01 ~]# subscription-manager facts --list | grep insights

NO UUID in the machine-id file 

Hence, NO FACTS collected and rhsm.log displays following  warning message 

2019-06-21 03:50:06,503 [WARNING] subscription-manager:10917:MainThread @collector.py:99 - Hardware detection [get_insights_machine_id] failed: 'module' object has no attribute 'machine_id_file'

3. On a RHSM registered RHEL7.7  system with NO insights registration 
=====================================================================

[root@ibm-ls22-01 ~]# subscription-manager register --auto-attach
Registering to: subscription.rhsm.stage.redhat.com:443/subscription
Username: stage_test_rhel77_sku
Password: 
The system has been registered with ID: 752fcb90-42ae-4294-b792-204cae77c550
The registered system name is: ibm-ls22-01.mpc.lab.eng.bos.redhat.com
Installed Product Current Status:
Product Name: Red Hat Enterprise Linux for x86_64 High Touch Beta
Status:       Subscribed

Product Name: Red Hat Enterprise Linux Server
Status:       Subscribed

[root@ibm-ls22-01 ~]# cat /etc/insights-client/machine-id
cat: /etc/insights-client/machine-id: No such file or directory
[root@ibm-ls22-01 ~]# cat /etc/redhat-access-insights/machine-id 
cat: /etc/redhat-access-insights/machine-id: No such file or directory
[root@ibm-ls22-01 ~]# subscription-manager facts --list | grep insights

NO UUID in the machine-id file 

NO FACTS collected and rhsm.log displays following  warning message 
2019-06-21 04:30:11,983 [WARNING] subscription-manager:11208:MainThread @collector.py:99 - Hardware detection [get_insights_machine_id] failed: 'module' object has no attribute 'machine_id_file'



4.  On a RHSM registered RHEL7.7  system with insights registration 
===================================================================

[root@ibm-ls22-01 ~]# redhat-access-insights --register
Bad status from server: 404
Bad status from server: 404
ERROR: Could not download dynamic configuration
Debug Info: 
Conf status: 404
Debug Info: 
Conf message: 
Bad status from server: 404
Insights API could not be reached to confirm registration status.
Running connection test...
Connection test config:
=== Begin Certificate Chain Test ===
depth=2
verify error:num=0
verify return:1
depth=1
verify error:num=0
verify return:1
depth=0
verify error:num=0
verify return:1
=== End Certificate Chain Test: SUCCESS ===

=== Begin Upload URL Connection Test ===
HTTP Status Code: 404
HTTP Status Text: Not Found
HTTP Response Text: 
Connection failed
=== End Upload URL Connection Test: FAILURE ===

=== Begin API URL Connection Test ===
HTTP Status Code: 404
HTTP Status Text: Not Found
HTTP Response Text: 
Connection failed
=== End API URL Connection Test: FAILURE ===


Connectivity tests completed with some errors
See /var/log/insights-client/insights-client.log for more details.

[root@ibm-ls22-01 ~]# cat /etc/redhat-access-insights/machine-id 
95c508e7-8818-47cc-9cbd-c4b9a0b9793b  --> UUID present
[root@ibm-ls22-01 ~]# 
[root@ibm-ls22-01 ~]# cat /etc/insights-client/machine-id
[root@ibm-ls22-01 ~]# 
[root@ibm-ls22-01 ~]# subscription-manager facts --list | grep insights
[root@ibm-ls22-01 ~]# subscription-manager facts --list | grep insight

still no fact for insights and following warning message in the log 
2019-06-21 04:33:43,954 [WARNING] subscription-manager:22034:MainThread @collector.py:99 - Hardware detection [get_insights_machine_id] failed: 'module' object has no attribute 'machine_id_file'

Observed that despite having the machine-id file with UUID ,the insights fact was not captured by subscription-manager .

Based on the above observation moving the bug to "New"

Comment 6 Chris Snyder 2019-06-21 18:38:33 UTC
This should be fixed in the latest build. Moving back to MODIFIED.

Comment 8 Rehana 2019-06-25 07:08:25 UTC
Verifying on :
===============
subscription management server: 2.3.17-1
subscription management rules: 5.35
subscription-manager: 1.24.13-1.el7


# rpm -qa subscription-manager --changelog | grep 1722238
- 1722238: Fix reporting insights id in facts on RHEL7 (jhnidek)
- 1722238: Report insights id as fact, when insights is installed

Scenario 1 :

[root@kvm-01-guest17 ~]# subscription-manager facts --list | grep insights
[root@kvm-01-guest17 ~]# rpm -qa insights-client
[root@kvm-01-guest17 ~]# 

NO FACTS collected when the insights-client package is not installed on the system --PASSED


Scenario 2: 
Installed redhat-access-insights and check the facts again 


#yum install redhat-access-insights (not shown the installation steps)
# rpm -qa insights-client
insights-client-3.0.3-9.el7_5.noarch

# cat /etc/redhat-access-insights/machine-id 
cat: /etc/redhat-access-insights/machine-id: No such file or directory

# subscription-manager facts --list | grep insights

redhat-access-insights/insights-client installed but machine id does not exist , Hence no fact value collected --> PASSED

Scenario 3: 

Try to register to redhat insights 

# redhat-access-insights --register
Running connection test...
=== Begin Upload URL Connection Test ===
HTTP Status Code: 401
HTTP Status Text: Unauthorized
HTTP Response Text: 
Connection failed
=== End Upload URL Connection Test: FAILURE ===

=== Begin API URL Connection Test ===
HTTP Status Code: 200
HTTP Status Text: OK
HTTP Response Text: lub-dub
Successfully connected to: https://cert-api.access.redhat.com/r/insights/
=== End API URL Connection Test: SUCCESS ===

Connectivity tests completed with some errors
See /var/log/insights-client/insights-client.log for more details.

# cat /etc/redhat-access-insights/machine-id
d41c0bff-7577-40af-9eb0-495c119a88ce

# subscription-manager facts --list | grep insights
insights_id: d41c0bff-7577-40af-9eb0-495c119a88ce

Though the registration was not successful , the machine id was created and the same has been captured in the facts list (on both cli and GUI (pfa:insights.png) --> PASSED


Scenario 4:
After registering to the production environment , get the system registered against insights server and check the facts again 

[root@kvm-01-guest17 ~]# subscription-manager register 
Registering to: subscription.rhsm.redhat.com:443/subscription
Username: QualityAssurance
Password: 
The system has been registered with ID: 509878e7-ae3e-449c-8ad2-48021e4fb81b
The registered system name is: kvm-01-guest17.lab.eng.rdu2.redhat.com

[root@kvm-01-guest17 ~]# subscription-manager facts --list | grep insights
insights_id: d41c0bff-7577-40af-9eb0-495c119a88ce

[root@kvm-01-guest17 ~]# redhat-access-insights --register
You successfully registered d41c0bff-7577-40af-9eb0-495c119a88ce to account 477931.
Successfully registered host kvm-01-guest17.lab.eng.rdu2.redhat.com
Automatic scheduling for Insights has been enabled.
Starting to collect Insights data for kvm-01-guest17.lab.eng.rdu2.redhat.com
Uploading Insights data.
Successfully uploaded report from kvm-01-guest17.lab.eng.rdu2.redhat.com to account 477931.

[root@kvm-01-guest17 ~]# subscription-manager facts --list | grep insights
insights_id: d41c0bff-7577-40af-9eb0-495c119a88ce

[root@kvm-01-guest17 ~]# cat /etc/redhat-access-insights/machine-id
d41c0bff-7577-40af-9eb0-495c119a88ce 

Facts value for insights_id is captured in both cli and GUI --> PASSED

Based on the above observations , moving the bug to Verified.

Comment 9 Rehana 2019-06-25 07:09:53 UTC
Created attachment 1584217 [details]
insights

Comment 11 errata-xmlrpc 2019-08-06 12:57:32 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, 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/RHBA-2019:2008