Bug 1266968 - hammer auth status returns exit code 0 even when login failed
Summary: hammer auth status returns exit code 0 even when login failed
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Hammer
Version: 6.1.2
Hardware: x86_64
OS: Linux
unspecified
low
Target Milestone: Unspecified
Assignee: Martin Bacovsky
QA Contact: Katello QA List
URL: http://projects.theforeman.org/issues...
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-09-28 17:02 UTC by Reartes Guillermo
Modified: 2017-01-05 15:10 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-01-05 15:10:13 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 13858 0 Normal New hammer auth status returns exit code 0 even when login failed 2020-06-02 11:11:20 UTC

Description Reartes Guillermo 2015-09-28 17:02:22 UTC
Description of problem:

In this example i do not specify neither an username nor a password:

[root@sixthsat2 ~]# hammer os list
[Foreman] Username: 
[Foreman] Password for : 
Nombre o password inválidos
[root@sixthsat2 ~]# echo $?
129

Similar to the above example:

# hammer --username fakeuser --password wrongpassword os list
Nombre o password inválidos
[root@sixthsat2 ~]# echo $?
129


But this is (imho) wrong:

[root@sixthsat2 ~]# hammer --username fakeuser --password wrongpassword auth status
Está identificado como 'fakeuser'
[root@sixthsat2 ~]# echo $?
0

There is no fakeuser user and the password is also wrong.
A proper non-zero exit conde should be returned, at least i do think so.

Does hammer first authenticate and then execute the 'auth status' or is different for some reason?



Version-Release number of selected component (if applicable):
Satellite 6.1.2
rubygem-hammer_cli-0.1.4.12-1.el7sat.noarch

How reproducible:
always

Steps to Reproduce:
[root@sixthsat2 ~]# hammer --username fakeuser --password wrongpassword auth status
Está identificado como 'fakeuser'
[root@sixthsat2 ~]# echo $?
0

Actual results:
exit code 0 returned

Expected results:
exit code 129 (or other, the most appropiate one) instead.

Additional info:
I was writing a simple script, i choose 'auth status' as the simplest command to call to test, since it does just the login part, before doing other stuff to the satellite. But since it always return 0, it is not usefull.

Comment 2 Bryan Kearney 2016-02-23 17:18:01 UTC
Created redmine issue http://projects.theforeman.org/issues/13858 from this bug

Comment 3 Bryan Kearney 2017-01-05 15:10:13 UTC
This is an older bug which has been reported upstream. We are not going to track this bug downstream. When the upstream issue is resolved, the next build will contain the fix. Thank you.


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