Bug 734533
Summary: | exit code for cli subscription-manager import --certificate=FOO should be 1 | ||
---|---|---|---|
Product: | Red Hat Enterprise Linux 6 | Reporter: | John Sefler <jsefler> |
Component: | subscription-manager | Assignee: | Bryan Kearney <bkearney> |
Status: | CLOSED ERRATA | QA Contact: | Entitlement Bugs <entitlement-bugs> |
Severity: | low | Docs Contact: | |
Priority: | unspecified | ||
Version: | 6.2 | CC: | awood, skallesh, spandey |
Target Milestone: | beta | ||
Target Release: | 6.3 | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2012-06-20 12:56:36 UTC | Type: | --- |
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: | 738066, 756082 |
Description
John Sefler
2011-08-30 17:28:06 UTC
What commands get you a 255? (In reply to comment #1) > What commands get you a 255? Well then... * an exit code of 1 would probably be more appropriate as suggested by http://www.daniweb.com/software-development/python/threads/31226/163923#post163923 * and the feedback message, "FOO is not a valid certificate file. Please use a valid certificate.", should probably be written to stdout Committed ddad607b1d46795122c57467f6653918e6b16116 In subscription-manager 0.99.4+ The code should now process all arguments but return a 1 if any of the arguments failed validation. E.g. # subscription-manager import --certificate=GOOD --certificate=BAD Successfully imported certificate GOOD BAD is not a valid certificate file. Please use a valid certificate. # echo $? 1 Correction: As of 62c62cc98d2708225444713b61b6067f8555753b (0.99.6+), the code will return a 1 only if *all* arguments fail. This change was made to make the return code behavior consistent with how subscription-manager subscribe works. Verifying Version... [root@jsefler-r63-server ~]# rpm -q subscription-manager subscription-manager-0.99.7-1.git.0.8137c52.el6.x86_64 [root@jsefler-r63-server ~]# subscription-manager import --certificate=FOO 1>/tmp/stdout 2>/tmp/stderr [root@jsefler-r63-server ~]# echo $? 1 [root@jsefler-r63-server ~]# cat /tmp/stdout FOO is not a valid certificate file. Please use a valid certificate. [root@jsefler-r63-server ~]# cat /tmp/stderr [root@jsefler-r63-server ~]# ^^^^^^^^ VERIFIED - importing a bad cert throws an exit code of 1 with stdout message [root@jsefler-r63-server ~]# subscription-manager import --certificate=/tmp/sm-importEntitlementsDir/6871632671492179691-key.pem --certificate=/tmp/sm-importCertificatesDir/cert.pem --certificate=/tmp/sm-importCertificatesDir/8003202248817161227.pem --certificate=/tmp/nonExistentFile.pem 1>/tmp/stdout 2>/tmp/stderr [root@jsefler-r63-server ~]# echo $? 0 [root@jsefler-r63-server ~]# cat /tmp/stdout 6871632671492179691-key.pem is not a valid certificate file. Please use a valid certificate. cert.pem is not a valid certificate file. Please use a valid certificate. Successfully imported certificate 8003202248817161227.pem nonExistentFile.pem is not a valid certificate file. Please use a valid certificate. [root@jsefler-r63-server ~]# cat /tmp/stderr [root@jsefler-r63-server ~]# ^^^^^^^^ VERIFIED - importing a mix of good/bad certs throws an exit code of 0 (as designed in comment 6) with stdout messages 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, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. http://rhn.redhat.com/errata/RHBA-2012-0804.html |