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 1030604 - subscription-manager repo-override should unwrap error list and print it to stderr
Summary: subscription-manager repo-override should unwrap error list and print it to s...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: subscription-manager
Version: 7.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Michael Stead
QA Contact: John Sefler
URL:
Whiteboard:
Depends On:
Blocks: rhsm-rhel70
TreeView+ depends on / blocked
 
Reported: 2013-11-14 19:10 UTC by John Sefler
Modified: 2014-06-18 00:28 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-06-13 10:25:23 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description John Sefler 2013-11-14 19:10:38 UTC
Description of problem:
The new subscription-manager repo-override module should unwrap the error list and print it to stderr (not stdout) as demonstrated below...


Version-Release number of selected component (if applicable):
[root@jsefler-7 ~]# rpm -q subscription-manager
subscription-manager-1.10.7-1.git.0.15d737b.el7.x86_64


How reproducible:


Steps to Reproduce:
1. register and attach a subscription that provides yum repos, then using one of the valid repoids, call...

[root@jsefler-7 ~]# subscription-manager repo-override --repo=awesomeos-ppc --repo=foo --add=baseurl:https://cdn.redhat.com/foo-testing 1>/tmp/stdout 2>/tmp/stderr
[root@jsefler-7 ~]# echo $?
255
[root@jsefler-7 ~]# cat /tmp/stderr
[root@jsefler-7 ~]# cat /tmp/stdout
[The value for name 'baseurl' is not allowed to be overridden., The value for name 'baseurl' is not allowed to be overridden.]
[root@jsefler-7 ~]#

Actual results:
above


Expected results:
The 255 exit code is expected
The [The value for name 'baseurl' is not allowed to be overridden., The value for name 'baseurl' is not allowed to be overridden.] should not be printed as a list.  This should be unwrapped and unique values should be printed to stderr (not stdout) delimited by a new line.

Comment 1 Michael Stead 2013-11-22 19:12:03 UTC
This will be a two part fix -- one for subscription-manager and one for candlepin.

On candlepin, a BadRequestException was being created and thrown with a List.toString() as the message which produced the "[..., ...]" message string. Also, the messages in that list were being duplicated as seen above which isn't very useful.

The Fix: Invalid overrides are collected in a set and a single message will be returned in the following format:

"Not allowed to override values for: NAME1, NAME2, ..."


Changes were required in subscription-manager to changed the error code and to print to stderr.

As requested by jsefler (irc), it will now return a code of 1 instead of 255, and will write to stderr.

Component version and pull request numbers to follow once reviewed and committed.

Comment 2 Michael Stead 2013-12-04 16:25:18 UTC
candlepin pull request (currently merged and in master branch):
https://github.com/candlepin/candlepin/pull/439

subscription-manager pull request (waiting on review and merge):
https://github.com/candlepin/subscription-manager/pull/836

Comment 3 Michael Stead 2013-12-04 18:43:32 UTC
Error code and stderr printing available in:
subscription-manager-1.10.8-1

Proper message formatting available in:
candlepin-0.8.34-1+

Comment 5 John Sefler 2013-12-06 19:32:30 UTC
Testing Version...
[root@jsefler-7 ~]# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 0.8.33-1
subscription-manager: 1.10.8-1.el7
python-rhsm: 1.10.8-1.el7


[root@jsefler-7 ~]# subscription-manager repo-override --repo=repo1 --repo=repo2 --repo=repo3 --add=baseurl:https://cdn.redhat.com/foo-testing --add=name:repoName --add=enabled:1 --add=label:repoLabel 1>/tmp/stdout 2>/tmp/stderr
[root@jsefler-7 ~]# echo $?
1
[root@jsefler-7 ~]# cat /tmp/stderr
Not allowed to override values for: name, label, baseurl
[root@jsefler-7 ~]# cat /tmp/stdout
[root@jsefler-7 ~]# 


VERIFIED: The feedback message is now nicely unwrapped and rendered uniquely.

For the sake of consistency with exitCode/stdout/stderr behavior from other subscription-manager commands, I would suggest that we keep the exitCode of 1 (which indicates the call was not completely successful (usually exitCode=0), but we were also not crashing and burning (usually exitCode=255)).  However, let's move the feedback message to stdout since stderr is usually accompanied by exitCode 255.

FAILEDQA: Move the message from stderr to stdout.

Comment 6 Michael Stead 2013-12-06 19:45:08 UTC
Awaiting PR Review:

https://github.com/candlepin/subscription-manager/pull/844

Print error to stdout, and exit with code 1.

Comment 7 Michael Stead 2014-01-06 14:30:49 UTC
Available:

subscription-manager-1.10.9-1+

Comment 8 Sharath Dwaral 2014-01-24 17:40:49 UTC
Version

# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 0.9.2-1
subscription-manager: 1.10.11-1.git.2.e96f6cd.el7
python-rhsm: 1.10.11-1.git.0.17362f9.el7

Verification

# subscription-manager repo-override --repo=repo1 --repo=repo2 --repo=repo3 --add=baseurl:https://cdn.redhat.com/foo-testing --add=name:repoName --add=enabled:1 --add=label:repoLabel > /tmp/stdout 2> /tmp/stderr

# echo $?
1

# cat /tmp/stdout
Not allowed to override values for: name, label, baseurl

# cat /tmp/stderr 
# 


Message displayed in stdout
Exit code is 1

VERIFIED

Comment 9 Ludek Smid 2014-06-13 10:25:23 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.


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