summaryrefslogtreecommitdiffstats
path: root/cli
diff options
context:
space:
mode:
authorSonaArora <sarora@redhat.com>2017-01-06 14:21:56 +0530
committerJeff Darcy <jdarcy@redhat.com>2017-01-12 18:54:58 -0800
commit27c85d014bb7d03c323e08038d9c6db538d632fb (patch)
tree479f93a970abf7abc38c94e729c8a9bedcd1d9cd /cli
parent522640be476a3f97dac932f7046f0643ec0ec2f2 (diff)
cli/geo-rep: Fix geo-rep status detail
Earlier this command works when master and slave volume args are given. Now it works even when no volume args are given (i.e. 'gluster volume geo-replication status detail) and also when master volume is given (i.e.'gluster volume geo-replication <master-vol> status detail'). BUG: 1410071 Signed-off-by: SonaArora <sarora@redhat.com> Change-Id: I1a39241a4a5d70c20b2326599b3cccd8f1f6dc78 Reviewed-on: http://review.gluster.org/16347 Smoke: Gluster Build System <jenkins@build.gluster.org> Tested-by: Kotresh HR <khiremat@redhat.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Kotresh HR <khiremat@redhat.com>
Diffstat (limited to 'cli')
-rw-r--r--cli/src/cli-cmd-parser.c40
1 files changed, 18 insertions, 22 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
index 94bda6766f2..151cc6d0034 100644
--- a/cli/src/cli-cmd-parser.c
+++ b/cli/src/cli-cmd-parser.c
@@ -2852,23 +2852,22 @@ cli_cmd_gsync_set_parse (const char **words, int wordcount, dict_t **options)
cmdi = slavei + 1;
if (slavei == 3)
masteri = 2;
- } else if (i <= 3) {
- if (!strcmp ((char *)words[wordcount-1], "detail")) {
- /* For status detail it is mandatory to provide
- * both master and slave */
- ret = -1;
- goto out;
+ } else if (i <= 4) {
+ if (strtail ("detail", (char *)words[wordcount-1])) {
+ cmdi = wordcount - 2;
+ if (i == 4)
+ masteri = 2;
+ } else {
+ /* no $s, can only be status cmd
+ * (with either a single $m before it or nothing)
+ * -- these conditions imply that i <= 3 after
+ * the iteration and that i is the successor of
+ * the (0 or 1 length) sequence of $m-s.
+ */
+ cmdi = i;
+ if (i == 3)
+ masteri = 2;
}
-
- /* no $s, can only be status cmd
- * (with either a single $m before it or nothing)
- * -- these conditions imply that i <= 3 after
- * the iteration and that i is the successor of
- * the (0 or 1 length) sequence of $m-s.
- */
- cmdi = i;
- if (i == 3)
- masteri = 2;
} else
goto out;
@@ -2933,15 +2932,12 @@ cli_cmd_gsync_set_parse (const char **words, int wordcount, dict_t **options)
if (ret)
goto out;
- if (!strcmp ((char *)words[wordcount-1], "detail")) {
- if (strcmp ((char *)words[wordcount-2], "status")) {
- ret = -1;
- goto out;
- }
- if (!slavei || !masteri) {
+ if (strtail ("detail", (char *)words[wordcount-1])) {
+ if (!strtail ("status", (char *)words[wordcount-2])) {
ret = -1;
goto out;
}
+
ret = dict_set_uint32 (dict, "status-detail", _gf_true);
if (ret)
goto out;