diff options
author | Pranith K <pranithk@gluster.com> | 2010-12-16 01:24:33 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2010-12-27 20:50:55 -0800 |
commit | 953f89d82f2c444719ba3150c9890c072a2e7fb3 (patch) | |
tree | b5756f8638ae9b93cf77a141d08184ecb94928a5 /cli/src/cli-cmd-peer.c | |
parent | e7512cbb171856a925b7db938da423b493339b00 (diff) |
glusterd,cli: print single error message on failure
Signed-off-by: Pranith Kumar K <pranithk@gluster.com>
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 1922 (Volume not present wrong message displayed on command line)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1922
Diffstat (limited to 'cli/src/cli-cmd-peer.c')
-rw-r--r-- | cli/src/cli-cmd-peer.c | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/cli/src/cli-cmd-peer.c b/cli/src/cli-cmd-peer.c index dc361f539..ca89592d6 100644 --- a/cli/src/cli-cmd-peer.c +++ b/cli/src/cli-cmd-peer.c @@ -48,9 +48,12 @@ cli_cmd_peer_probe_cbk (struct cli_state *state, struct cli_cmd_word *word, rpc_clnt_procedure_t *proc = NULL; call_frame_t *frame = NULL; dict_t *dict = NULL; + int sent = 0; + int parse_error = 0; if (!(wordcount == 3)) { cli_usage_out (word->pattern); + parse_error = 1; goto out; } @@ -79,8 +82,11 @@ cli_cmd_peer_probe_cbk (struct cli_state *state, struct cli_cmd_word *word, } out: - if (ret) - cli_out ("Probe failed"); + if (ret) { + cli_cmd_sent_status_get (&sent); + if ((sent == 0) && (parse_error == 0)) + cli_out ("Peer probe failed"); + } return ret; } @@ -93,9 +99,12 @@ cli_cmd_peer_deprobe_cbk (struct cli_state *state, struct cli_cmd_word *word, rpc_clnt_procedure_t *proc = NULL; call_frame_t *frame = NULL; dict_t *dict = NULL; + int sent = 0; + int parse_error = 0; if (!(wordcount == 3) ) { cli_usage_out (word->pattern); + parse_error = 1; goto out; } @@ -122,6 +131,12 @@ cli_cmd_peer_deprobe_cbk (struct cli_state *state, struct cli_cmd_word *word, } out: + if (ret) { + cli_cmd_sent_status_get (&sent); + if ((sent == 0) && (parse_error == 0)) + cli_out ("Peer detach failed"); + } + return ret; } @@ -132,9 +147,12 @@ cli_cmd_peer_status_cbk (struct cli_state *state, struct cli_cmd_word *word, int ret = -1; rpc_clnt_procedure_t *proc = NULL; call_frame_t *frame = NULL; + int sent = 0; + int parse_error = 0; if (wordcount != 2) { cli_usage_out (word->pattern); + parse_error = 1; goto out; } @@ -149,8 +167,11 @@ cli_cmd_peer_status_cbk (struct cli_state *state, struct cli_cmd_word *word, } out: - if (ret) - cli_out ("Command Execution failed"); + if (ret) { + cli_cmd_sent_status_get (&sent); + if ((sent == 0) && (parse_error == 0)) + cli_out ("Peer status failed"); + } return ret; } @@ -166,11 +187,10 @@ struct cli_cmd cli_probe_cmds[] = { { "peer status", cli_cmd_peer_status_cbk, "list status of peers"}, - - { "peer help", - cli_cmd_peer_help_cbk, - "Help command for peer "}, + { "peer help", + cli_cmd_peer_help_cbk, + "Help command for peer "}, { NULL, NULL, NULL } }; |