Bug 673520

Summary: wallaby -arg and feature-import --help return wrong exit code
Product: Red Hat Enterprise MRG Reporter: Matthew Farrellee <matt>
Component: wallabyAssignee: Will Benton <willb>
Status: CLOSED ERRATA QA Contact: Tomas Rusnak <trusnak>
Severity: unspecified Docs Contact:
Priority: low    
Version: 1.3CC: iboverma, jneedle, mhusnain, trusnak
Target Milestone: 2.0   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: wallaby-0.10.5-4 Doc Type: Bug Fix
Doc Text:
Certain wallaby utility subcommands caused wallaby to exit with an unintuitive exit code, such as with 0 (zero, indicating success) instead of a non-zero exit code (indicating failure). With this update, wallaby exits with more intuitive exit codes that reflect the success or failure of the underlying operation.
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-06-23 15:42:22 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: 693778    

Description Matthew Farrellee 2011-01-28 14:36:31 UTC
Split from bug 635628 -

Lubos Trilety 2011-01-28 08:13:22 EST

Version:
wallaby-0.10.4-2

There are still some commands which ends with incorrect code: 

1.) Following command shouldn't print invalid option and should end with
success - 0
# wallaby feature-import --help
invalid option: --help
Usage:  wallaby feature-import [options] FILE
Imports a wallaby feature from a specially-formatted configuration file.
    -h, --help                       displays this message
    -n, --name NAME                  name for given feature (overrides one
specified in the file)
# echo $?
1

2.) Wallaby command with invalid argument should exit with non-zero code
# wallaby -arg
invalid argument: -arg
Usage:  wallaby [options] command [command-args]
Use "wallaby help commands" for a list of commands
    -h, --help                       shows this message
    -H, --host HOSTNAME              qpid broker host (default localhost)
    -p, --port NUM                   qpid broker port (default 5672)
    -U, --user NAME                  qpid username
    -P, --password PASS              qpid password
    -M, --auth-mechanism PASS        authentication mechanism (ANONYMOUS,
PLAIN, GSSAPI)
# echo $?
0

Comment 1 Matthew Farrellee 2011-01-28 14:39:47 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
C: Arguments -arg and feature-import --help exit with code 0 and 1 respectively.
C: This is confusing, since -arg is not a valid argument and 0 suggests success. The opposite is true for feature-import --help.
F:  These cases are handled generally as a result of internal improvements to the wallaby shell.
R:  The wallaby shell will now exit with an appropriate exit status.

Comment 2 Douglas Silas 2011-02-10 12:20:37 UTC
    Technical note updated. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    Diffed Contents:
@@ -1,4 +1 @@
-C: Arguments -arg and feature-import --help exit with code 0 and 1 respectively.
+Certain wallaby utility subcommands caused wallaby to exit with an unintuitive exit code, such as with 0 (zero, indicating success) instead of a non-zero exit code (indicating failure). With this update, wallaby exits with more intuitive exit codes that reflect the success or failure of the underlying operation.-C: This is confusing, since -arg is not a valid argument and 0 suggests success. The opposite is true for feature-import --help.
-F:  These cases are handled generally as a result of internal improvements to the wallaby shell.
-R:  The wallaby shell will now exit with an appropriate exit status.

Comment 4 Tomas Rusnak 2011-04-20 13:58:32 UTC
Retested over current wallaby:

#  rpm -q wallaby-utils
wallaby-utils-0.10.5-3.el6.noarch


# wallaby feature-import --help
Usage:  wallaby feature-import [options] FILE
Imports a wallaby feature from a specially-formatted configuration file.
    -h, --help                       displays this message
    -n, --name NAME                  name for given feature (overrides one specified in the file)
# echo $?
0

#  wallaby -arg
invalid argument: -arg
Usage:  wallaby [options] command [command-args]
Use "wallaby help commands" for a list of commands
    -h, --help                       shows this message
    -H, --host HOSTNAME              qpid broker host (default localhost)
    -p, --port NUM                   qpid broker port (default 5672)
    -U, --user NAME                  qpid username
    -P, --password PASS              qpid password
    -M, --auth-mechanism PASS        authentication mechanism (ANONYMOUS, PLAIN, GSSAPI)
# echo $?
0

Second issue still present on both supported archs RHEL5/RHEL6. If you try to 'wallaby -arg', or any other non-existent argument, the result code should be non-zero.

Comment 5 Will Benton 2011-04-26 15:40:43 UTC
These issues are all fixed.  Please file a new bug for further return code issues.

Comment 6 Tomas Rusnak 2011-04-27 08:47:53 UTC
Retested with current version:
wallaby-utils-0.10.5-4.el6.noarch

#  wallaby -arg
invalid argument: -arg
Usage:  wallaby [options] command [command-args]
Use "wallaby help commands" for a list of commands
    -h, --help                       shows this message
    -H, --host HOSTNAME              qpid broker host (default localhost)
    -p, --port NUM                   qpid broker port (default 5672)
    -U, --user NAME                  qpid username
    -P, --password PASS              qpid password
    -M, --auth-mechanism PASS        authentication mechanism (ANONYMOUS, PLAIN, GSSAPI)
# echo $?
1

Return code was corrected.

>>> VERIFIED

Comment 7 Misha H. Ali 2011-06-06 03:23:16 UTC
Technical note can be viewed in the release notes for 2.0 at the documentation stage here:

http://documentation-stage.bne.redhat.com/docs/en-US/Red_Hat_Enterprise_MRG/2.0/html-single/MRG_Release_Notes/index.html#tabl-MRG_Release_Notes-GRID_Update_Notes-RHM_Known_Issues

Comment 8 errata-xmlrpc 2011-06-23 15:42:22 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHEA-2011-0889.html