diff options
author | Vijay Bellur <vijay@gluster.com> | 2011-08-22 20:28:50 +0530 |
---|---|---|
committer | Vijay Bellur <vijay@gluster.com> | 2011-08-22 08:06:24 -0700 |
commit | 1acef91232abbeb5fbf9a5fce2c71cba0df2a86c (patch) | |
tree | 8f0c2c4044b08695ea64a55b8482ee40f1495620 | |
parent | ab6494bddc6c5dcf298f04bb38ff222952eae8d2 (diff) |
Change-Id: Icab7965f570e3c422e5b18b89bc418f3598c2c4d
BUG: 3120
Reviewed-on: http://review.gluster.com/297
Reviewed-by: Vijay Bellur <vijay@gluster.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
-rw-r--r-- | cli/src/cli-cmd.c | 4 | ||||
-rw-r--r-- | cli/src/cli.c | 6 | ||||
-rw-r--r-- | cli/src/cli.h | 1 |
3 files changed, 10 insertions, 1 deletions
diff --git a/cli/src/cli-cmd.c b/cli/src/cli-cmd.c index 982d39d1b..a9016ae36 100644 --- a/cli/src/cli-cmd.c +++ b/cli/src/cli-cmd.c @@ -132,7 +132,9 @@ cli_cmd_process (struct cli_state *state, int argc, char **argv) if ( strcmp (word->word,"help")==0 ) goto callback; - ret = cli_cmd_await_connected (cli_cmd_needs_connection (word)); + state->await_connected = cli_cmd_needs_connection (word); + + ret = cli_cmd_await_connected (state->await_connected); if (ret) { cli_out ("Connection failed. Please check if gluster " "daemon is operational."); diff --git a/cli/src/cli.c b/cli/src/cli.c index e4e7444e8..7341c7e8f 100644 --- a/cli/src/cli.c +++ b/cli/src/cli.c @@ -352,6 +352,12 @@ cli_rpc_notify (struct rpc_clnt *rpc, void *mydata, rpc_clnt_event_t event, { gf_log (this->name, GF_LOG_TRACE, "got RPC_CLNT_DISCONNECT"); connected = 0; + if (!global_state->prompt && global_state->await_connected) { + ret = 1; + cli_out ("Connection failed. Please check if gluster " + "daemon is operational."); + exit (ret); + } break; } diff --git a/cli/src/cli.h b/cli/src/cli.h index aa09e8108..2b599488b 100644 --- a/cli/src/cli.h +++ b/cli/src/cli.h @@ -105,6 +105,7 @@ struct cli_state { char *remote_host; int remote_port; int mode; + int await_connected; }; struct cli_local { |