Bug 1959048

Summary: what does 'Warning: This org does not have any subscriptions with an available "addons" is empty.' mean to the user?
Product: Red Hat Enterprise Linux 9 Reporter: John Sefler <jsefler>
Component: subscription-managerAssignee: Pino Toscano <ptoscano>
Status: CLOSED CURRENTRELEASE QA Contact: Red Hat subscription-manager QE Team <rhsm-qe>
Severity: high Docs Contact:
Priority: medium    
Version: 9.0CC: cdonnell, ptoscano, redakkan
Target Milestone: betaKeywords: EasyFix, Triaged
Target Release: 9.0 BetaFlags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: subscription-manager-1.29.14-1.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-12-07 21:55:02 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 John Sefler 2021-05-10 16:05:11 UTC
Description of problem:
This is a follow up to Bug 1897767 for which changes have been made in https://github.com/candlepin/subscription-manager/commit/f4d903a88422ee661dc66459305d993b892be91a

The following message will be displayed when a user tries to add a syspurpose addon value when the organization has not purchased any subscriptions that provide a syspurpose addon attribute.  In this case, there are no valid addon values to set.

[root@kvm-07-guest13 ~]# subscription-manager addons --add "EUS"
Warning: This org does not have any subscriptions with an available "addons" is empty.
addons updated.

My complaint is that this message is difficult to understand. I suggest changing the string to...

'Warning: This organization does not have any subscriptions that provide a system purpose "{attr}".  This setting will not influence auto-attaching subscriptions.'

Likewise this change also applies to "role", "usage", and "service_level_agreement".




Version-Release number of selected component (if applicable):
[root@kvm-07-guest13 ~]# rpm -q subscription-manager
subscription-manager-1.29.12-1.el9.x86_64
[root@kvm-07-guest13 ~]# rpm -q subscription-manager --changelog | grep 1897767 
- 1897767: what does 'No Valid values provided for usage' mean to the user
- 1897767: what does 'No valid values provided for usage' mean to the user


How reproducible:


Steps to Reproduce:
[root@kvm-07-guest13 ~]# subscription-manager register --serverurl=subscription.rhsm.stage.redhat.com --user=stage_bug_nosyspurpose
Registering to: subscription.rhsm.stage.redhat.com:443/subscription
Password: 
The system has been registered with ID: 35545647-fb71-40f7-834c-daf56642cea5
The registered system name is: kvm-07-guest13.hv2.lab.eng.bos.redhat.com

[root@kvm-07-guest13 ~]# subscription-manager addons --add "EUS"
Warning: This org does not have any subscriptions with an available "addons" is empty.
addons updated.

[root@kvm-07-guest13 ~]# subscription-manager role --set "Red Hat Enterprise Linux Server"
Warning: This org does not have any subscriptions with an available "role" is empty.
role set to "Red Hat Enterprise Linux Server".

[root@kvm-07-guest13 ~]# subscription-manager usage --set "Development/Test"
Warning: This org does not have any subscriptions with an available "usage" is empty.
usage set to "Development/Test".

[root@kvm-07-guest13 ~]# subscription-manager service-level --set "Standard"
Warning: This org does not have any subscriptions with an available "service_level_agreement" is empty.
service_level_agreement set to "Standard".


Actual results:
Warning: This org does not have any subscriptions with an available "{attr}" is empty.

Expected results:
Warning: This organization does not have any subscriptions that provide a system purpose "{attr}".  This setting will not influence auto-attaching subscriptions.

Additional info:
This string change can be made on line 214 of /usr/lib64/python3.9/site-packages/subscription_manager/cli_command/abstract_syspurpose.py



--------------------------------------------------------

Very similar to the string change above, I also recommend changing line 347 of /usr/lib64/python3.9/site-packages/subscription_manager/cli_command/abstract_syspurpose.py which affects the list commands like this...

[root@kvm-07-guest13 ~]# subscription-manager addons --list
This org does not have any subscriptions with an available "addons"

[root@kvm-07-guest13 ~]# subscription-manager role --list
This org does not have any subscriptions with an available "role"

[root@kvm-07-guest13 ~]# subscription-manager usage --list
This org does not have any subscriptions with an available "usage"

and change line 182 of /usr/lib64/python3.9/site-packages/subscription_manager/cli_command/service_level.py which affects this list command...

[root@kvm-07-guest13 ~]# subscription-manager service-level --list
This org does not have any subscriptions with an available "service level".

Actual Results
above

Expected Results
This organization does not have any subscriptions with an available "{syspurpose_attr}".
NOTICE THAT ORG IS NOT ABBREVIATED AND THE SENTENCE ENDS WITH A PERIOD

Comment 2 Rehana 2021-06-03 15:07:54 UTC
Reproducing the failure on: 
===========================
# subscription-manager version
server type: This system is currently not registered.
subscription management server: 3.2.18-1
subscription management rules: 5.41
subscription-manager: 1.29.12-1.el9

# subscription-manager register --serverurl=subscription.rhsm.stage.redhat.com --user=*****
Registering to: subscription.rhsm.stage.redhat.com:443/subscription
Password: 
The system has been registered with ID: *******
The registered system name is:**********

# subscription-manager addons --add "EUS"
Warning: This org does not have any subscriptions with an available "addons" is empty.
addons updated.

# subscription-manager role --set "Red Hat Enterprise Linux Server"
Warning: This org does not have any subscriptions with an available "role" is empty.
role set to "Red Hat Enterprise Linux Server".

# subscription-manager usage --set "Development/Test"
Warning: This org does not have any subscriptions with an available "usage" is empty.
usage set to "Development/Test".

# subscription-manager service-level --set "Standard"
Warning: This org does not have any subscriptions with an available "service_level_agreement" is empty.
service_level_agreement set to "Standard".


Pre-testing  the fix on :
==========================
# subscription-manager version
server type: This system is currently not registered.
subscription management server: 3.2.18-1
subscription management rules: 5.41
subscription-manager: 1.29.12-1.git.56.f6ec6a1.el9

# subscription-manager register --serverurl=subscription.rhsm.stage.redhat.com --user=******
Registering to: subscription.rhsm.stage.redhat.com:443/subscription
Password: 
The system has been registered with ID: *******
The registered system name is: **********

# subscription-manager addons --add "EUS"
Warning: There are no available values for the system purpose "addons" from the available subscriptions in this organization.
addons updated.

# subscription-manager role --set "Red Hat Enterprise Linux Server"
Warning: There are no available values for the system purpose "role" from the available subscriptions in this organization.
role set to "Red Hat Enterprise Linux Server".

# subscription-manager usage --set "Development/Test"
Warning: There are no available values for the system purpose "usage" from the available subscriptions in this organization.
usage set to "Development/Test".

# subscription-manager service-level --set "Standard"
Warning: There are no available values for the system purpose "service_level_agreement" from the available subscriptions in this organization.
service_level_agreement set to "Standard".

# subscription-manager role --list
There are no available values for the system purpose "role" from the available subscriptions in this organization.

# subscription-manager addons --list
There are no available values for the system purpose "addons" from the available subscriptions in this organization.

# subscription-manager usage --list
There are no available values for the system purpose "usage" from the available subscriptions in this organization.

#  subscription-manager service-level --list
This org does not have any subscriptions with an available "service level".

^^ Notice the message is not updated for service-level --list 

Also I dont see the message " Warning: This organization does not have any subscriptions that provide a system purpose "{attr}".  This setting will not influence auto-attaching subscriptions. " when setting a bad value, instead I see 

# subscription-manager role --set=foo
Warning: There are no available values for the system purpose "role" from the available subscriptions in this organization.
role set to "foo".

Notice the text "This setting will not influence auto-attaching subscriptions" is missing . 

Moving back to New

Comment 3 Pino Toscano 2021-06-10 14:33:16 UTC
So, we had a offline conversation about this, and we thought about the following:

1) the distinction between "missing syspurpose attribute in the SKU" and "the syspurpose has no valid value" is a bit stretched, and in the end there is little value in showing different messages to the user (they cannot do anything about either, anyway)

2) the message for "service-level" was indeed missed because there is a slightly different implementation of "syspurpose command" for "service_level"

3) "This setting will not influence auto-attaching subscriptions." is only shown on --set/--add and not on --list: this is because they are an "active action" rather than a simple query

Hence, the changes (submitted upstream as [1]) are the following:

a) the message for either missing and empty syspurpose values on --set/--add becomes:
'Warning: This organization does not have any subscriptions that provide a system purpose "{attr}".  This setting will not influence auto-attaching subscriptions.'
(obviously {attr} means the actual syspurpose attribute)

b) the message for either missing and empty syspurpose values on --list (also for "service_level") becomes:
'There are no available values for the system purpose "{syspurpose_attr}" from the available subscriptions in this organization.'
(obviously {syspurpose_attr} means the actual syspurpose attribute)

[1] https://github.com/candlepin/subscription-manager/pull/2656

Comment 4 Rehana 2021-06-30 11:40:53 UTC
Pre-verifying on:
===============

# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 3.2.18-1
subscription management rules: 5.41
subscription-manager: 1.29.15-1.git.14.dcbf3e7.el9

# rpm -q subscription-manager --changelog | grep 1959048
- 1959048: improve wording for invalid syspurpose values (ptoscano)
- 1959048: improve wording for missing or empty syspurpose values

# subscription-manager register
Registering to: subscription.rhsm.stage.redhat.com:443/subscription
Username: stage_test_nosku
Password: 
The system has been registered with ID: *************
The registered system name is: ****

#  subscription-manager usage --list
There are no available values for the system purpose "usage" from the available subscriptions in this organization.

# subscription-manager role --list
There are no available values for the system purpose "role" from the available subscriptions in this organization.

# subscription-manager addons --list
There are no available values for the system purpose "addons" from the available subscriptions in this organization.

# subscription-manager service-level --list
There are no available values for the system purpose "service_level" from the available subscriptions in this organization.

Based on the above observations , setting verified:tested.

Comment 7 Rehana 2021-07-19 09:47:32 UTC
Verifying on :
============
# subscription-manager version
server type: This system is currently not registered.
subscription management server: 3.2.19-1
subscription management rules: 5.41
subscription-manager: 1.29.18-1.el9

# rpm -q subscription-manager --changelog | grep 1959048
- 1959048: improve wording for invalid syspurpose values (ptoscano)
- 1959048: improve wording for missing or empty syspurpose values

# subscription-manager register
Registering to: subscription.rhsm.stage.redhat.com:443/subscription
Username: stage_test_nosku
Password: 
The system has been registered with ID: 79903f73-2195-49cd-b934-7614df79fe8e
The registered system name is: kvm-08-guest26.hv2.lab.eng.bos.redhat.com

# subscription-manager usage --list
There are no available values for the system purpose "usage" from the available subscriptions in this organization.

# subscription-manager role --list
There are no available values for the system purpose "role" from the available subscriptions in this organization.

# subscription-manager addons --list
There are no available values for the system purpose "addons" from the available subscriptions in this organization.

# subscription-manager service-level --list
There are no available values for the system purpose "service_level" from the available subscriptions in this organization.

Based on the above observations moving the bug to Verified!!