Bug #13858
openhammer auth status returns exit code 0 even when login failed
Description
Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1266968
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.