Red Hat Bugzilla – Bug 781251
cli exits 0 if command fails due to connection issues
Last modified: 2014-08-24 20:49:18 EDT
Description of problem:
The gluster cli properly exits with error code if a command was performed but failed; however, if the connection gets broken in the middle, it exits with 0 which lets the caller falsely conclude that the command succeeded.
Version-Release number of selected component (if applicable):
all >= 3.1
(the PoC code might be specific to master)
Steps to Reproduce:
1. start glusterd with "--xlator-option=management.rpc-auth-allow-insecure=off"
2. as a nonprivileged user, do "gluster --log-file=- volume info"
# the query fails as now glusterd requires a privileged user to connect,
# thus it closes the connection as soon as it detects that it's not the case
3. echo $?
Csaba, this bug is fixed with http://review.gluster.com/2640 right? If yes, please mark it for ON_QA
Verified on v3.3.0qa44. With steps as described above, get proper non-zero return value.
-!- ~ » glusterd --xlator-option=management.rpc-auth-allow-insecure=off
As a normal-user,
--- ~ » gluster --log-file=- volume info
[2012-05-31 15:43:52.058710] W [rpc-transport.c:174:rpc_transport_load] 0-rpc-transport: missing 'option transport-type'. defaulting to "socket"
[2012-05-31 15:43:52.127289] W [socket.c:1512:__socket_proto_state_machine] 0-glusterfs: reading from socket failed. Error (Transport endpoint is not connected), peer (::1:24007)
[2012-05-31 15:43:52.127535] E [rpc-clnt.c:373:saved_frames_unwind] (-->/usr/local/lib/libgfrpc.so.0(rpc_clnt_notify+0xd0) [0x7fdd4c272020] (-->/usr/local/lib/libgfrpc.so.0(rpc_clnt_connection_cleanup+0xb0) [0x7fdd4c271c90] (-->/usr/local/lib/libgfrpc.so.0(saved_frames_destroy+0xe) [0x7fdd4c271bbe]))) 0-glusterfs: forced unwinding frame type(Gluster CLI) op(--(5)) called at 2012-05-31 15:43:52.127079 (xid=0x1x)
No volumes present
[2012-05-31 15:43:52.127579] I [cli-rpc-ops.c:732:gf_cli3_1_get_volume_cbk] 0-cli: Returning: -1
Connection failed. Please check if gluster daemon is operational.
[2012-05-31 15:43:52.127613] I [input.c:46:cli_batch] 0-: Exiting with: -1
--- ~ » echo $?
--- ~ »