Bug 1654094

Summary: system purpose status on Satellite is not correct
Product: Red Hat Satellite Reporter: qianzhan
Component: CandlepinAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED ERRATA QA Contact: jcallaha
Severity: high Docs Contact:
Priority: high    
Version: 6.5.0CC: bcourt, egolov, jsefler, khowell, sgao
Target Milestone: 6.5.0Keywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: candlepin-2.5.8-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-05-14 12:39:09 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:
Bug Depends On: 1640215    
Bug Blocks:    
Attachments:
Description Flags
system_purpose_is_matched_when_specified_sla_is_covered_by_consumed_subscription.png
none
system_purpose_is_matched_when_system_subscribed_without_specifying_syspurpose_value.png none

Description qianzhan 2018-11-28 03:03:14 UTC
Description of problem:
system purpose status on Satellite is not correct

Version-Release number of selected component (if applicable):
candlepin-2.5.7-1.el7.noarch

How reproducible:
always

Steps to Reproduce:
1. Register RHEL-8.0-20181120.0 against Satellite6.5-snapshot5.0, and auto-attach:


[root@dell-r730-001-guest27 ~]# subscription-manager register
Registering to: ibm-ls22-03.rhts.eng.brq.redhat.com:443/rhsm
Username: admin
Password: 
The system has been registered with ID: 38cee7a4-23ce-48a8-baa2-db65e67aa4ae
The registered system name is: dell-r730-001-guest27.dsal.lab.eng.rdu2.redhat.com

[root@dell-r730-001-guest27 ~]# subscription-manager attach
Installed Product Current Status:
Product Name: Red Hat Enterprise Linux for x86_64 High Touch Beta
Status:       Subscribed

[root@dell-r730-001-guest27 ~]# subscription-manager list --con
+-------------------------------------------+
   Consumed Subscriptions
+-------------------------------------------+
Subscription Name:   Red Hat Enterprise Linux High Touch Beta
Provides:            Red Hat Enterprise Linux for x86_64 High Touch Beta
                     Red Hat Container Images HTB
                     Red Hat Enterprise Linux 7 Workstation High Touch Beta
                     Red Hat Enterprise Linux for IBM z Systems High Touch Beta
                     Red Hat Enterprise Linux for Power, little endian High Touch Beta
                     Red Hat Enterprise Linux 7 for HPC Compute Node High Touch Beta
                     Red Hat Enterprise Linux for Real Time High Touch Beta
                     Red Hat Enterprise Linux High Availability High Touch Beta
                     Red Hat Enterprise Linux for ARM 64 High Touch Beta
                     Red Hat Enterprise Linux Atomic Host HTB
                     Red Hat Enterprise Linux 7 Load Balancer High Touch Beta
                     Red Hat Enterprise Linux for Real Time for NFV High Touch Beta
                     Red Hat Enterprise Linux Resilient Storage High Touch Beta
                     Red Hat Enterprise Linux 7 Desktop High Touch Beta
SKU:                 RH00076
Contract:            11631334
Account:             6128518
Serial:              5034262512951535773
Pool ID:             8aa800ef674eb4d101674f9d02731984
Provides Management: No
Active:              True
Quantity Used:       1
Service Level:       Self-Support
Service Type:        L1-L3
Status Details:      Subscription is current
Subscription Type:   Standard
Starts:              03/13/2018
Ends:                03/12/2019
System Type:         Physical

2. No system purpose specified:
(1) System purpose on RHEL8.0:

[root@dell-r730-001-guest27 ~]# syspurpose show
{
  "role": "",
  "addons": [
    ""
  ],
  "service_level_agreement": "",
  "usage": ""
}
[root@dell-r730-001-guest27 ~]# subscription-manager status
+-------------------------------------------+
   System Status Details
+-------------------------------------------+
Overall Status: Current

System Purpose Status: invalid


(2) The system purpose status on satellite WebUI: Mismatched
Please see attachment 'no_system_purpose_specified_the_status_on_satellite_is_mismatched.png'


3. Specify SLA as 'Self-Support' which can be covered by the consumed subscription:

(1) System purpose status on RHEL8.0:

[root@dell-r730-001-guest27 ~]# syspurpose set-sla 'Self-Support'
service_level_agreement set to Self-Support
System purpose successfully sent to subscription management server.

[root@dell-r730-001-guest27 ~]# syspurpose show
{
  "service_level_agreement": "Self-Support",
  "addons": [
    ""
  ],
  "role": "",
  "usage": ""
}

[root@dell-r730-001-guest27 ~]# subscription-manager status
+-------------------------------------------+
   System Status Details
+-------------------------------------------+
Overall Status: Current

System Purpose Status: invalid

(2) The system purpose status on satellite WebUI: Mismatched
Please see attachment 'specified_sla_is_covered_by_subscription_the_status_on_satellite_is_mismatched.png'

Actual results:
As step 2 and step 3, the system purpose status is wrong.

Expected results:
In step 2, no system purpose is specified which means the consumed subscription cover all system purpose attributes. So the system purpose on RHEL8.0 should be 'None specified', and the system purpose on Satellite Web UI should be 'Matched'.

In step 3: the only specified system purpose is service level, and the consumed subscription provide the same service level. So the system purpose on RHEL8.0 should be 'Matched', and the system purpose on Satellite Web UI should be 'Matched'.

Additional info:

Comment 3 qianzhan 2019-01-28 09:15:57 UTC
Verification:
python3-subscription-manager-rhsm-1.23.8-14.el8.x86_64
subscription-manager-rhsm-certificates-1.23.8-14.el8.x86_64
dnf-plugin-subscription-manager-1.23.8-14.el8.x86_64
subscription-manager-1.23.8-14.el8.x86_64
candlepin-2.5.8-1.el7.noarch
tfm-rubygem-katello-3.10.0.15-1.el7sat.noarch
katello-3.10.0-0.6.rc1.el7sat.noarch

1. Register RHEL-8.0-20190116.1 against Satellite6.5-snapshot13.0, and auto-attach:

[root@ibm-x3650m4-01-vm-05 ~]# subscription-manager list --consu
+-------------------------------------------+
   Consumed Subscriptions
+-------------------------------------------+
Subscription Name:   Red Hat Enterprise Linux High Touch Beta
Provides:            Red Hat Enterprise Linux for x86_64 High Touch Beta
                     Red Hat Enterprise Linux 7 Workstation High Touch Beta
                     Red Hat Container Images HTB
                     Red Hat Enterprise Linux for IBM z Systems High Touch Beta
                     Red Hat Enterprise Linux for Power, little endian High Touch Beta
                     Red Hat CodeReady Linux Builder for x86_64 High Touch Beta
                     Red Hat Enterprise Linux 7 for HPC Compute Node High Touch Beta
                     Red Hat CodeReady Linux Builder for Power, little endian High Touch Beta
                     Red Hat Enterprise Linux for Real Time High Touch Beta
                     Red Hat Enterprise Linux for ARM 64 High Touch Beta
                     Red Hat Enterprise Linux Atomic Host HTB
                     Red Hat Enterprise Linux High Availability High Touch Beta
                     Red Hat CodeReady Linux Builder for ARM 64 High Touch Beta
                     Red Hat Enterprise Linux 7 Load Balancer High Touch Beta
                     Red Hat CodeReady Linux Builder for IBM z Systems High Touch Beta
                     Red Hat Enterprise Linux Resilient Storage High Touch Beta
                     Red Hat Enterprise Linux for Real Time for NFV High Touch Beta
                     Red Hat Enterprise Linux 7 Desktop High Touch Beta
SKU:                 RH00076
Contract:            11679348
Account:             6167181
Serial:              1077306249237379169
Pool ID:             8ac213b1689368a60168937b98bd1681
Provides Management: No
Active:              True
Quantity Used:       1
Service Level:       Self-Support
Service Type:        L1-L3
Status Details:      Subscription is current
Subscription Type:   Standard
Starts:              01/01/2019
Ends:                12/31/2019
System Type:         Physical


2. The system purpose is not set:


[root@ibm-x3650m4-01-vm-05 ~]# syspurpose show
{}
System purpose successfully sent to subscription management server.
[root@ibm-x3650m4-01-vm-05 ~]# subscription-manager status
+-------------------------------------------+
   System Status Details
+-------------------------------------------+
Overall Status: Current

Traceback (most recent call last):
  File "/usr/sbin/subscription-manager", line 11, in <module>
    load_entry_point('subscription-manager==1.23.8', 'console_scripts', 'subscription-manager')()
  File "/usr/lib64/python3.6/site-packages/subscription_manager/scripts/subscription_manager.py", line 85, in main
    return managercli.ManagerCLI().main()
  File "/usr/lib64/python3.6/site-packages/subscription_manager/managercli.py", line 2920, in main
    ret = CLI.main(self)
  File "/usr/lib64/python3.6/site-packages/subscription_manager/cli.py", line 183, in main
    return cmd.main()
  File "/usr/lib64/python3.6/site-packages/subscription_manager/managercli.py", line 506, in main
    return_code = self._do_command()
  File "/usr/lib64/python3.6/site-packages/subscription_manager/managercli.py", line 2901, in _do_command
    print(_("System Purpose Status: %s\n") % syspurpose_cache.get_overall_status())
  File "/usr/lib64/python3.6/site-packages/subscription_manager/cache.py", line 335, in get_overall_status
    return self.syspurpose_service.get_overall_status(self.server_status['status'])
TypeError: 'NoneType' object is not subscriptable


3. Check satellite web ui for system purpose status: The status is 'Matched' <==== VERIFIED
Please see attachment 'system_purpose_is_matched_when_system_subscribed_without_specifying_syspurpose_value.png'


4. Specify SLA as 'Self-Support' which can be covered by the consumed subscription:
[root@ibm-x3650m4-01-vm-05 ~]# syspurpose set-sla 'Self-Support'
service_level_agreement set to Self-Support
System purpose successfully sent to subscription management server.
[root@ibm-x3650m4-01-vm-05 ~]# syspurpose show
{
  "service_level_agreement": "Self-Support"
}
System purpose successfully sent to subscription management server.


5. Check satellite web ui for system purpose status: The status is  'Matched' <==== VERIFIED
Please see attachment 'system_purpose_is_matched_when_specified_sla_is_covered_by_consumed_subscription.png'


Moving this bug to VERIFIED.

Comment 4 qianzhan 2019-01-28 09:17:25 UTC
Created attachment 1524168 [details]
system_purpose_is_matched_when_specified_sla_is_covered_by_consumed_subscription.png

Comment 5 qianzhan 2019-01-28 09:18:19 UTC
Created attachment 1524169 [details]
system_purpose_is_matched_when_system_subscribed_without_specifying_syspurpose_value.png

Comment 8 errata-xmlrpc 2019-05-14 12:39:09 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/RHSA-2019:1222