Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1875595

Summary: when not registered, subscription-manager is blocked from sending --org option to set the service-level
Product: Red Hat Enterprise Linux 8 Reporter: John Sefler <jsefler>
Component: subscription-managerAssignee: William Poteat <wpoteat>
Status: CLOSED ERRATA QA Contact: Red Hat subscription-manager QE Team <rhsm-qe>
Severity: low Docs Contact:
Priority: high    
Version: 8.3CC: jhnidek, redakkan, skallesh
Target Milestone: rcKeywords: Triaged
Target Release: 8.0Flags: pm-rhel: mirror+
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-05-18 13:33:55 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:    
Bug Blocks: 1842946    

Description John Sefler 2020-09-03 20:22:01 UTC
Description of problem:

Due to a lot of recent changes in the ability and the feedback given when trying to set a service-level while not registered and due to an old limitation "--org is only supported with the --list option" a user belonging to multiple orgs can be stopped from setting a service-level.  See the steps to reproduce below.


Version-Release number of selected component (if applicable):
[root@ibm-x3650m4-01-vm-06 ~]# rpm -q subscription-manager
subscription-manager-1.27.15-1.el8.x86_64


How reproducible:
This case is easy to reproduce when the user belongs to multiple orgs (as tested with an onpremise Candlepin server with TESTDATA deployed).

Steps to Reproduce:
[root@ibm-x3650m4-01-vm-06 ~]# subscription-manager config --server.hostname=rhsm-auto8-candlepin.usersys.redhat.com --server.port=8443 --server.prefix=/candlepin

[root@ibm-x3650m4-01-vm-06 ~]# subscription-manager service-level --show
This system is not yet registered. Try 'subscription-manager register --help' for more information.

[root@ibm-x3650m4-01-vm-06 ~]# subscription-manager service-level --list
Error: you must register or specify --username and --password to list service levels

[root@ibm-x3650m4-01-vm-06 ~]# subscription-manager service-level --list --username=testuser1 --password=password
Organization: admin
+-------------------------------------------+
           Available Service Levels
+-------------------------------------------+
Full-Service
None
Premium
Standard
Super
Ultimate SLA

[root@ibm-x3650m4-01-vm-06 ~]# subscription-manager service-level --list --username=testuser1 --password=password --org=admin
+-------------------------------------------+
           Available Service Levels
+-------------------------------------------+
Full-Service
None
Premium
Standard
Super
Ultimate SLA

[root@ibm-x3650m4-01-vm-06 ~]# subscription-manager service-level --set=Premium --username=testuser1 --password=password
Organization: admin
service_level_agreement set to "Premium".

[root@ibm-x3650m4-01-vm-06 ~]# subscription-manager service-level --set=Premium --username=testuser1 --password=password --org=admin
Error: --org is only supported with the --list option



Actual results:
  above - "Error: --org is only supported with the --list option" when the --org option is passed on the command line

Expected results:
  the user should now be allowed to pass --org as an option on the command line




Likewise the help message should be corrected...
[root@ibm-x3650m4-01-vm-06 ~]# subscription-manager service-level --help | grep -A2 -- "--org"
  --org=ORG_KEY         specify an organization when listing available service
                        levels using the organization key, only used with
                        --list



Additional info:

Comment 1 John Sefler 2020-09-03 20:29:15 UTC
For comparison, the same sequence of steps is successful when executed against the role module - the user is not blocked when passing --org as an option...

[root@ibm-x3650m4-01-vm-06 ~]# subscription-manager role --list --username=testuser1 --password=password
Organization: admin
+-------------------------------------------+
               Available role
+-------------------------------------------+
 - SP Starter
 - SP Server

[root@ibm-x3650m4-01-vm-06 ~]# subscription-manager role --list --username=testuser1 --password=password --org=admin
+-------------------------------------------+
               Available role
+-------------------------------------------+
 - SP Starter
 - SP Server

[root@ibm-x3650m4-01-vm-06 ~]# subscription-manager role --set="SP Server" --username=testuser1 --password=password
Organization: admin
role set to "SP Server".

[root@ibm-x3650m4-01-vm-06 ~]# subscription-manager role --set="SP Server" --username=testuser1 --password=password --org=admin
role set to "SP Server".

Comment 2 John Sefler 2020-09-04 03:12:30 UTC
Continuing the odd experience for setting service-level while not registered...

[root@ibm-x3650m4-01-vm-06 ~]# subscription-manager service-level --show
This system is not yet registered. Try 'subscription-manager register --help' for more information.
[root@ibm-x3650m4-01-vm-06 ~]# 
[root@ibm-x3650m4-01-vm-06 ~]# subscription-manager service-level --set=Premium
Organization: foobar                 <====== STRANGE: WHY AM I BEING PROMPTED FOR ORG?
service_level_agreement set to "Premium".
[root@ibm-x3650m4-01-vm-06 ~]# 

This case is strange because I was prompted to specify an organization and the value that I entered was completely disregarded.
I should not have been prompted for an organization since there was no --username and no --password provided. 

[root@ibm-x3650m4-01-vm-06 ~]# subscription-manager service-level --set=Premium --org=foobar
Error: --org is only supported with the --list option

And now we are back to the original complaint in comment 0, --org should be allowed with the --set option especially when --username and --password are also provided.


It seems like the appropriate behavior when any one of the (--username|--password|--org) options are specified is to prompt for the remaining needed value(s) to authenticate a connection to the server.

Comment 4 Shwetha Kallesh 2020-10-27 07:36:41 UTC
Reproducer:

[root@hpe-dl380pgen8-02-vm-12 ~]# subscription-manager version
server type: This system is currently not registered.
subscription management server: 3.1.21-1
subscription management rules: 5.41
subscription-manager: 1.27.16-1.el8


[root@hpe-dl380pgen8-02-vm-12 ~]# subscription-manager service-level --list --username=testuser1 --password=password
Organization: admin
+-------------------------------------------+
           Available Service Levels
+-------------------------------------------+
Full-Service
None
Premium
Standard
Super

[root@hpe-dl380pgen8-02-vm-12 ~]# subscription-manager service-level --list --username=testuser1 --password=password --org=admin
+-------------------------------------------+
           Available Service Levels
+-------------------------------------------+
Full-Service
None
Premium
Standard
Super
[root@hpe-dl380pgen8-02-vm-12 ~]# subscription-manager service-level --set=Premium --username=testuser1 --password=password
Organization: admin
service_level_agreement set to "Premium".

[root@hpe-dl380pgen8-02-vm-12 ~]# subscription-manager service-level --set=Premium --username=testuser1 --password=password --org=admin
Error: --org is only supported with the --list option

Comment 5 Shwetha Kallesh 2020-10-27 09:27:53 UTC
Early Testing/verification comment

[root@hpe-dl380pgen8-02-vm-12 ~]# subscription-manager version
server type: This system is currently not registered.
subscription management server: 3.1.21-1
subscription management rules: 5.41
subscription-manager: 1.28.5-1.git.0.f474dc9.el8
[root@hpe-dl380pgen8-02-vm-12 ~]# 


[root@hpe-dl380pgen8-02-vm-12 ~]# subscription-manager service-level --list --username=testuser1 --password=password
Organization: admin
+-------------------------------------------+
           Available Service Levels
+-------------------------------------------+
Full-Service
None
Premium
Standard
Super
[root@hpe-dl380pgen8-02-vm-12 ~]# subscription-manager service-level --list --username=testuser1 --password=password --org=admin
+-------------------------------------------+
           Available Service Levels
+-------------------------------------------+
Full-Service
None
Premium
Standard
Super
[root@hpe-dl380pgen8-02-vm-12 ~]# subscription-manager service-level --set=Premium --username=testuser1 --password=password
Organization: admin
service_level_agreement set to "Premium".

[root@hpe-dl380pgen8-02-vm-12 ~]# syspurpose show
{
  "service_level_agreement": "Premium"
}

[root@hpe-dl380pgen8-02-vm-12 ~]# subscription-manager service-level --set=Standard --username=testuser1 --password=password --org=admin
service_level_agreement set to "Standard".
^^ no more error message

[root@hpe-dl380pgen8-02-vm-12 ~]# syspurpose show
{
  "service_level_agreement": "Standard"
}^^ sla is successfully set to Standard now

[root@hpe-dl380pgen8-02-vm-12 ~]# subscription-manager service-level --set=Premium
service_level_agreement set to "Premium".
^^ no longer prompted for org
[root@hpe-dl380pgen8-02-vm-12 ~]# subscription-manager service-level --set=Premium --org=foobar
service_level_agreement set to "Premium".
^^ no error message

Comment 8 John Sefler 2020-11-12 21:56:19 UTC
Verifying fix in nightly compose RHEL-8.4.0-20201112.n.1:

     Beaker Test information:
                         HOSTNAME=kvm-02-guest10.hv2.lab.eng.bos.redhat.com
                            JOBID=4725191
                         RECIPEID=9051109
                    RESULT_SERVER=
                           DISTRO=RHEL-8.4.0-20201112.n.1
                     ARCHITECTURE=x86_64

      Job Whiteboard: Reserve Workflow provision of distro RHEL-8.4.0-20201112.n.1 on any lab system for 86400 seconds

      Recipe Whiteboard: 
**  **  **  **  **  **  **  **  **  **  **  **  **  **  **  **  **  **
Last login: Thu Nov 12 13:37:55 2020 from 10.10.120.132
[root@kvm-02-guest10 ~]# 
[root@kvm-02-guest10 ~]# rpm -q subscription-manager
subscription-manager-1.28.5-1.el8.x86_64
[root@kvm-02-guest10 ~]# 
[root@kvm-02-guest10 ~]# rpm -q subscription-manager --changelog | grep 1875595
- 1875595: Service-Level set issues (wpoteat)
[root@kvm-02-guest10 ~]# 
[root@kvm-02-guest10 ~]# subscription-manager service-level --list
Error: you must register or specify --username and --password to list service levels
[root@kvm-02-guest10 ~]# 
[root@kvm-02-guest10 ~]# subscription-manager service-level --list --username=testuser1 --password=password
Organization: admin
+-------------------------------------------+
           Available Service Levels
+-------------------------------------------+
Full-Service
None
Premium
Standard
Super
[root@kvm-02-guest10 ~]# 
[root@kvm-02-guest10 ~]# subscription-manager service-level --list --username=testuser1 --password=password --org=admin
+-------------------------------------------+
           Available Service Levels
+-------------------------------------------+
Full-Service
None
Premium
Standard
Super
[root@kvm-02-guest10 ~]# 
[root@kvm-02-guest10 ~]# subscription-manager service-level --set=Premium --username=testuser1 --password=password
Organization: admin
service_level_agreement set to "Premium".
[root@kvm-02-guest10 ~]# 
[root@kvm-02-guest10 ~]# subscription-manager service-level --set=Premium --username=testuser1 --password=password --org=admin
service_level_agreement set to "Premium".
[root@kvm-02-guest10 ~]# 
[root@kvm-02-guest10 ~]# subscription-manager service-level --set=Premium
service_level_agreement set to "Premium".
[root@kvm-02-guest10 ~]# 
[root@kvm-02-guest10 ~]# subscription-manager service-level --set=Premium --org=admin
service_level_agreement set to "Premium".
[root@kvm-02-guest10 ~]# 
[root@kvm-02-guest10 ~]# subscription-manager service-level --set=PremumTypo --username=testuser1 --password=password --org=admin
Warning: Provided value "PremumTypo" is not included in the list of valid values
 - Full-Service
 - Super
 - Standard
 - Premium
 - None
service_level_agreement set to "PremumTypo".
[root@kvm-02-guest10 ~]# 


VERIFIED: The user is now allowed to pass --org as an option on the command line when setting service-level.
VERIFIED: The user is now prompted for an org (if needed) when --username and --password are provided.
VERIFIED: When passing all credentials including --org, the service-level is set (and a warning is displayed for unknown service levels) - bonus verification.

Moving bugzilla to Status:VERIFIED

Comment 10 errata-xmlrpc 2021-05-18 13:33:55 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 (subscription-manager bug fix and enhancement update), 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-2021:1575