summaryrefslogtreecommitdiffstats
path: root/cli/src
diff options
context:
space:
mode:
authorPranith K <pranithk@gluster.com>2011-01-13 01:25:09 +0000
committerAnand V. Avati <avati@dev.gluster.com>2011-01-26 23:42:07 -0800
commit26e1bfc68a6b4dff95d5fb244076116896add68d (patch)
treed0dac826d83e99a5d89068a325a1aa3fe4e2f2af /cli/src
parent5fd43d28ff12ac1c4e4d60e77a38659013b1ab3a (diff)
cli: return error when cmd execution fails
Signed-off-by: Pranith Kumar K <pranithk@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 2287 (Gluster CLI returns wrong return code.) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2287
Diffstat (limited to 'cli/src')
-rw-r--r--cli/src/cli3_1-cops.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/cli/src/cli3_1-cops.c b/cli/src/cli3_1-cops.c
index 3003469cb..a98815020 100644
--- a/cli/src/cli3_1-cops.c
+++ b/cli/src/cli3_1-cops.c
@@ -321,7 +321,7 @@ gf_cli3_1_list_friends_cbk (struct rpc_req *req, struct iovec *iov,
out:
cli_cmd_broadcast_response (ret);
if (ret)
- cli_out ("Command Execution Failed");
+ cli_out ("Peer status unsuccessful");
if (dict)
dict_destroy (dict);
@@ -380,9 +380,9 @@ gf_cli3_1_get_volume_cbk (struct rpc_req *req, struct iovec *iov,
data_t *value = NULL;
int opt_count = 0;
int k = 0;
-
-
+ char err_str[2048] = {0};
+ snprintf (err_str, sizeof (err_str), "Volume info unsuccessful");
if (-1 == req->rpc_status) {
goto out;
}
@@ -440,9 +440,10 @@ gf_cli3_1_get_volume_cbk (struct rpc_req *req, struct iovec *iov,
goto out;
} else if (!count && (local->u.get_vol.flags ==
GF_CLI_GET_VOLUME)) {
- cli_out ("Volume %s not present",
+ snprintf (err_str, sizeof (err_str),
+ "Volume %s does not exist",
local->u.get_vol.volname);
- ret = 0;
+ ret = -1;
goto out;
}
@@ -523,7 +524,7 @@ gf_cli3_1_get_volume_cbk (struct rpc_req *req, struct iovec *iov,
ret = -1;
goto out;
}
-
+
snprintf (key, 256, "volume%d.opt_count",i);
ret = dict_get_int32 (dict, key, &opt_count);
if (ret)
@@ -568,7 +569,7 @@ gf_cli3_1_get_volume_cbk (struct rpc_req *req, struct iovec *iov,
out:
cli_cmd_broadcast_response (ret);
if (ret)
- cli_out ("Command Execution Failed");
+ cli_out (err_str);
if (dict)
dict_destroy (dict);