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 2028894

Summary: subscription-manager service-level --serverurl encounters a "'dict' object has no attribute 'result'"
Product: Red Hat Enterprise Linux 9 Reporter: John Sefler <jsefler>
Component: subscription-managerAssignee: mhorky
Status: CLOSED ERRATA QA Contact: Red Hat subscription-manager QE Team <rhsm-qe>
Severity: medium Docs Contact:
Priority: medium    
Version: 9.0CC: mhorky, redakkan, zpetrace
Target Milestone: rcKeywords: Triaged
Target Release: 9.0Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: subscription-manager-1.29.23-1.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-05-17 15:58:19 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-12-03 17:07:34 UTC
Description of problem:
As a follow-on to the scenarios from bug 916362 and bug 1846825 which negatively attempt to show the currently configured service level while passing a different serverurl than the one currently registered to, subscription-manager is failing hard with a "dict' object has no attribute 'result'".

Version-Release number of selected component (if applicable):
[root@kvm-07-guest34 ~]# rpm -q subscription-manager
subscription-manager-1.29.21-1.el9.x86_64


How reproducible:


Steps to Reproduce:
[root@kvm-07-guest34 ~]# subscription-manager register --serverurl=subscription.rhsm.stage.redhat.com:443/subscription
Registering to: subscription.rhsm.stage.redhat.com:443/subscription
Username: stage_rhsmqe_testuser01
Password: 
The system has been registered with ID: 77731bfd-3286-4b5c-97e9-18c21f1ea327
The registered system name is: kvm-07-guest34.hv2.lab.eng.bos.redhat.com
[root@kvm-07-guest34 ~]# 
[root@kvm-07-guest34 ~]# subscription-manager service-level --serverurl=subscription.rhn.redhat.com:443/subscription
'dict' object has no attribute 'result'
[root@kvm-07-guest34 ~]# 
[root@kvm-07-guest34 ~]# subscription-manager service-level --serverurl=subscription.rhn.redhat.com:443/subscription --show
'dict' object has no attribute 'result'
[root@kvm-07-guest34 ~]# 
[root@kvm-07-guest34 ~]# subscription-manager syspurpose service-level --serverurl=subscription.rhn.redhat.com:443/subscription
'dict' object has no attribute 'result'
[root@kvm-07-guest34 ~]# 
[root@kvm-07-guest34 ~]# subscription-manager syspurpose service-level --serverurl=subscription.rhn.redhat.com:443/subscription --show
'dict' object has no attribute 'result'

Actual results:
'dict' object has no attribute 'result'

Expected results:
Historically long ago the expected result was...
>   "You are already registered to a different system"
and then changed to...
>   "Invalid credentials."

Personally I think this is an invalid combination (or lack of) options and the user should have included a --list option as shown below in the Additional Info.  In my opinion, the expected result should be "Error: --serverurl should only be used with --list".



Additional info:
[root@kvm-07-guest34 ~]# subscription-manager service-level --serverurl=subscription.rhn.redhat.com:443/subscription --list
Invalid credentials. (HTTP error code 401: Unauthorized)

[root@kvm-07-guest34 ~]# subscription-manager service-level --serverurl=subscription.rhn.redhat.com:443/subscription --list --username=rhelentqe --password=REDACTED
Error: --username, --password, --token and --org can be used only on unregistered systems

Comment 1 John Sefler 2021-12-03 17:12:44 UTC
Note: This negative test scenario is passing on RHEL 8.6 with "Invalid credentials." as the result...

[root@ibm-x3650m4-01-vm-16 ~]# cat /etc/redhat-release 
Red Hat Enterprise Linux release 8.6 Beta (Ootpa)
[root@ibm-x3650m4-01-vm-16 ~]# rpm -q subscription-manager
subscription-manager-1.28.24-1.el8.x86_64

[root@ibm-x3650m4-01-vm-16 ~]# subscription-manager register --serverurl=subscription.rhsm.stage.redhat.com:443/subscription
Registering to: subscription.rhsm.stage.redhat.com:443/subscription
Username: stage_rhsmqe_testuser01
Password: 
The system has been registered with ID: f3fb8cba-3147-4865-99dd-2092bf6933ba
The registered system name is: ibm-x3650m4-01-vm-16.ibm2.lab.eng.bos.redhat.com

[root@ibm-x3650m4-01-vm-16 ~]# subscription-manager service-level --serverurl=subscription.rhn.redhat.com:443/subscription
Invalid credentials. (HTTP error code 401: Unauthorized)

[root@ibm-x3650m4-01-vm-16 ~]# subscription-manager service-level --serverurl=subscription.rhn.redhat.com:443/subscription --list
Invalid credentials. (HTTP error code 401: Unauthorized)

[root@ibm-x3650m4-01-vm-16 ~]# subscription-manager syspurpose service-level --serverurl=subscription.rhn.redhat.com:443/subscription
Invalid credentials. (HTTP error code 401: Unauthorized)

[root@ibm-x3650m4-01-vm-16 ~]# subscription-manager syspurpose service-level --serverurl=subscription.rhn.redhat.com:443/subscription --list
Invalid credentials. (HTTP error code 401: Unauthorized)

Comment 4 Zdenek Petracek 2022-01-20 15:26:55 UTC
Version:
[root@kvm-01-guest11 ~]# subscription-manager version
server type: This system is currently not registered.
subscription management server: 3.2.22-1
subscription management rules: 5.41
subscription-manager: 1.29.23-1.git.8.0557699.el9

Registering:
[root@kvm-01-guest11 ~]# subscription-manager register --serverurl=subscription.rhsm.stage.redhat.com:443/subscription
Registering to: subscription.rhsm.stage.redhat.com:443/subscription
Username: zpetracePH03
Password: 
The system has been registered with ID: e38d7dbc-cd77-44f1-a272-244472daad94
The registered system name is: kvm-01-guest11.rhts.eng.tlv.redhat.com

Pre-verifying on registered system:
[root@kvm-01-guest11 ~]# subscription-manager service-level --serverurl=subscription.rhn.redhat.com:443/subscription
Error: --username, --password, --token, --org and --serverurl can be used only on unregistered systems

[root@kvm-01-guest11 ~]# subscription-manager service-level --serverurl=subscription.rhn.redhat.com:443/subscription --list
Error: --username, --password, --token, --org and --serverurl can be used only on unregistered systems

[root@kvm-01-guest11 ~]# subscription-manager syspurpose service-level --serverurl=subscription.rhn.redhat.com:443/subscription --list
Error: --username, --password, --token, --org and --serverurl can be used only on unregistered systems

[root@kvm-01-guest11 ~]# subscription-manager service-level --serverurl=subscription.rhn.redhat.com:443/subscription --show
Error: --username, --password, --token, --org and --serverurl can be used only on unregistered systems

--> PASSED

Pre-verifying on unregistered system:
[root@kvm-01-guest11 ~]# subscription-manager unregister
Unregistering from: subscription.rhsm.stage.redhat.com:443/subscription
System has been unregistered.

[root@kvm-01-guest11 ~]# subscription-manager service-level --serverurl=subscription.rhn.redhat.com:443/subscription --show
Service-level not set.

[root@kvm-01-guest11 ~]# subscription-manager syspurpose service-level --serverurl=subscription.rhn.redhat.com:443/subscription --list
Error: you must register or specify --username and --password to list service levels

[root@kvm-01-guest11 ~]# subscription-manager service-level --serverurl=subscription.rhn.redhat.com:443/subscription
Service-level not set.

--> PASSED

Comment 7 Rehana 2022-02-07 06:24:35 UTC
Verifying on : 
# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 3.2.22-1
subscription management rules: 5.41
subscription-manager: 1.29.23-1.el9

# rpm -qa subscription-manager --changelog | grep 2028894
- 2028894: Don't allow service-level --serverurl on registered system

On a registered system : 
# subscription-manager service-level --serverurl=subscription.rhn.redhat.com:443/subscription
Error: --username, --password, --token, --org and --serverurl can be used only on unregistered systems

# subscription-manager service-level --serverurl=subscription.rhn.redhat.com:443/subscription --show
Error: --username, --password, --token, --org and --serverurl can be used only on unregistered systems

# subscription-manager syspurpose service-level --serverurl=subscription.rhn.redhat.com:443/subscription
Error: --username, --password, --token, --org and --serverurl can be used only on unregistered systems

# subscription-manager syspurpose service-level --serverurl=subscription.rhn.redhat.com:443/subscription --show
Error: --username, --password, --token, --org and --serverurl can be used only on unregistered systems

On a unregistered system: 

# subscription-manager unregister
Unregistering from: subscription.rhsm.stage.redhat.com:443/subscription
System has been unregistered.

# subscription-manager service-level --serverurl=subscription.rhn.redhat.com:443/subscription --show
Service-level not set.

# subscription-manager syspurpose service-level --serverurl=subscription.rhn.redhat.com:443/subscription --list
Error: you must register or specify --username and --password to list service levels

# subscription-manager service-level --serverurl=subscription.rhn.redhat.com:443/subscription
Service-level not set.

Based on the above observations, Verifying the bug.

Comment 9 errata-xmlrpc 2022-05-17 15:58:19 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 (new packages: subscription-manager), 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-2022:3984