Hide Forgot
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.
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.
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
Error code and stderr printing available in: subscription-manager-1.10.8-1 Proper message formatting available in: candlepin-0.8.34-1+
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.
Awaiting PR Review: https://github.com/candlepin/subscription-manager/pull/844 Print error to stdout, and exit with code 1.
Available: subscription-manager-1.10.9-1+
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
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.