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 1976240 - [RFE] improve HTTP code/message reporting in error strings
Summary: [RFE] improve HTTP code/message reporting in error strings
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: subscription-manager
Version: 9.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: beta
: 9.0 Beta
Assignee: mhorky
QA Contact: Red Hat subscription-manager QE Team
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-06-25 15:27 UTC by Pino Toscano
Modified: 2022-05-17 16:29 UTC (History)
4 users (show)

Fixed In Version: subscription-manager-1.29.21-1.el9
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-05-17 15:58:13 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github candlepin subscription-manager pull 2706 0 None Merged 1976240: Improve HTTP code/message reporting in error strings 2021-09-21 12:57:15 UTC
Red Hat Bugzilla 1961390 1 medium CLOSED Encountering an unexpected "HTTP error (403 - Forbidden)" when attempting to attach non-multi-entitlement pools with a q... 2021-06-25 15:32:54 UTC
Red Hat Product Errata RHBA-2022:3984 0 None None None 2022-05-17 15:58:25 UTC

Description Pino Toscano 2021-06-25 15:27:57 UTC
Description of problem:
As described in bug 1961390: in recent versions of subscription-manager, the HTTP error code & message is prefixed to the string printed to the user in case of errors, e.g.:

  # subscription-manager attach --quantity=2 --pool=8a99f9ac75743133017575f553fc0093 --pool=8a99f9ac75743133017575f5541c0095
  HTTP error (403 - Forbidden): Multi-entitlement not supported for pool with ID "8a99f9ac75743133017575f553fc0093".

During triaging, we decided that printing the HTTP code & message is something that was actually supposed to happen for a very long time, and apparently "it didn't happen". The only issue is that the HTTP bits are printed before the actual error message, and thus may give an unfriendly look at the message, possibly even making it more scary than it actually is.

The proposal is thus to rework the error message printed to the user, moving the HTTP bits at the end of the message; a potential example for the above output is:

  # subscription-manager attach --quantity=2 --pool=8a99f9ac75743133017575f553fc0093 --pool=8a99f9ac75743133017575f5541c0095
  Multi-entitlement not supported for pool with ID "8a99f9ac75743133017575f553fc0093" (HTTP error 403, Forbidden).

Comment 2 John Sefler 2021-06-25 15:49:06 UTC
I like the proposal with a small change to the format.  Let's complete the message with a period before appending the suffix as shown in this example, and let's make use of the already existing translations for string src/subscription_manager/exceptions.py:RESTLIB_MESSAGE = _(u"HTTP error code %s: %s")

  # subscription-manager attach --quantity=2 --pool=8a99f9ac75743133017575f553fc0093
  Multi-entitlement not supported for pool with ID "8a99f9ac75743133017575f553fc0093". (HTTP error code 403: Forbidden)

Comment 3 Zdenek Petracek 2021-11-11 12:50:52 UTC
[root@kvm-08-guest11 ~]# rpm -q subscription-manager --changelog | grep 1976240
- 1976240: Improve HTTP code/message reporting in error strings
[root@kvm-08-guest11 ~]# subscription-manager version

Version:
server type: Red Hat Subscription Management
subscription management server: 3.2.21-1
subscription management rules: 5.41
subscription-manager: 1.29.19-1.git.119.033bf98.el9

Registering:
[root@kvm-08-guest11 ~]# subscription-manager register
Registering to: subscription.rhsm.stage.redhat.com:443/subscription
Username: zpetracePH03
Password: 
The system has been registered with ID: dec1b13c-eacf-4f6e-8878-f3f2819dc2f8
The registered system name is: kvm-08-guest11.hv2.lab.eng.bos.redhat.com

Available pools:
[root@kvm-08-guest11 ~]# subscription-manager list --avail --pool-only
8a99f9ac7b5ee892017bc59cbab16930
8a99f9ac7b5ee892017bc59f5c236932
8a99f9ad7bca8239017bdf952e2e051d
8a99f9ad7bca8239017bdf952e77051f
8a99f9ad7bca8239017bdf954e010521

Pre-verification 1:
[root@kvm-08-guest11 ~]# subscription-manager attach --quantity=2 --pool=8a99f9ac7b5ee892017bc59cbab16930 --pool=8a99f9ac7b5ee892017bc59f5c236932
Multi-entitlement not supported for pool with ID "8a99f9ac7b5ee892017bc59f5c236932". (HTTP error code 403: Forbidden)
^^ message fits the suggested comment --> PASSED

Pre-verification 2:
[root@kvm-08-guest11 ~]# subscription-manager attach --quantity=3 --pool=8a99f9ac7b5ee892017bc59f5c236932
Multi-entitlement not supported for pool with ID "8a99f9ac7b5ee892017bc59f5c236932". (HTTP error code 403: Forbidden)
^^ message fits the suggested comment --> PASSED

Comment 7 Rehana 2021-12-01 12:15:14 UTC
Verifying on :
=============

# rpm -q subscription-manager --changelog | grep 1976240
- 1976240: Improve HTTP code/message reporting in error strings

# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 3.2.21-1
subscription management rules: 5.41
subscription-manager: 1.29.21-1.el9

# subscription-manager list --avail --pool-only
8a99f9ac7d4946d5017d567aee5c0437
8a99f9ac7d4946d5017d56fb218e0480
8a99f9af7d4d1194017d5676eeba04cf

# subscription-manager attach --pool 8a99f9ac7d4946d5017d567aee5c0437 --quantity=2
Multi-entitlement not supported for pool with ID "8a99f9ac7d4946d5017d567aee5c0437". (HTTP error code 403: Forbidden)

^^ notice the error codes were move to the end of message . Verifying the bug

Comment 9 errata-xmlrpc 2022-05-17 15:58:13 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


Note You need to log in before you can comment on or make changes to this bug.