Bug 783542

Summary: exit code from install-num-migrate-to-rhsm should be 1, not 255 when bad input is supplied
Product: Red Hat Enterprise Linux 5 Reporter: John Sefler <jsefler>
Component: subscription-managerAssignee: Alex Wood <awood>
Status: CLOSED CURRENTRELEASE QA Contact: Entitlement Bugs <entitlement-bugs>
Severity: low Docs Contact:
Priority: unspecified    
Version: 5.8CC: jmolet, skallesh, spandey
Target Milestone: rcKeywords: QA-Closed
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-01-09 17:45:39 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 771748    

Description John Sefler 2012-01-20 19:06:00 UTC
Description of problem:
As learned in https://bugzilla.redhat.com/show_bug.cgi?id=734533#c3 the exit code for a bad input should probably be 1 with a message to stdout, exitcode of 255 should be saved for uncaught tracebacks.

Version-Release number of selected component (if applicable):
[root@jsefler-onprem-5server ~]# rpm -q subscription-manager-migration
subscription-manager-migration-0.98.13-1.git.0.9bcbcab.el5


How reproducible:


Steps to Reproduce:
[root@jsefler-onprem-5server ~]# install-num-migrate-to-rhsm --dryrun --instnumber 123 1>/tmp/stdout 2>/tmp/stderr
[root@jsefler-onprem-5server ~]# echo $?
255
[root@jsefler-onprem-5server ~]# cat /tmp/stdout
Could not parse the installation number: Unsupported string length
[root@jsefler-onprem-5server ~]# cat /tmp/stderr
[root@jsefler-onprem-5server ~]# 
  

Expected results:
The error message written to stdout is fine, but the exit code should probably be 1.

Comment 1 John Sefler 2012-01-20 21:35:33 UTC
Here's another case where the exitCode should probably be 1.

[root@jsefler-onprem-5server rhn]# ls
clientCaps.d  rhnsd  up2date
[root@jsefler-onprem-5server rhn]# install-num-migrate-to-rhsm 
Could not read installation number from /etc/sysconfig/rhn/install-num.  Aborting.
[root@jsefler-onprem-5server rhn]# echo $?
255

Comment 2 Alex Wood 2012-01-31 14:32:30 UTC
Committed e794c7fe2b0ba65d508f7b37f88d31b097f7801b

Available in 0.99.5+

Comment 3 spandey 2012-06-15 09:49:23 UTC
verified using following rpm 

subscription-manager-1.0.3-1.git.69.b87abd7.el5
subscription-manager-firstboot-1.0.3-1.git.69.b87abd7.el5
subscription-manager-migration-data-1.11.1.1-1.git.2.c7fbafe.el5
subscription-manager-migration-1.0.3-1.git.69.b87abd7.el5
subscription-manager-gui-1.0.3-1.git.69.b87abd7.el5

[root@dhcp193-122 ~]# install-num-migrate-to-rhsm
Could not read installation number from /etc/sysconfig/rhn/install-num.  Aborting.
[root@dhcp193-122 ~]# echo $?
1

[root@dhcp193-122 ~]# install-num-migrate-to-rhsm -d -i 123 1>/tmp/stdout 2>/tmp/syderr
[root@dhcp193-122 ~]# echo $?
1

resolving defect as verified

Comment 4 Bryan Kearney 2013-01-09 17:45:39 UTC
Batch change of verified bugs which must have missed making the errata.