From 27c85d014bb7d03c323e08038d9c6db538d632fb Mon Sep 17 00:00:00 2001 From: SonaArora Date: Fri, 6 Jan 2017 14:21:56 +0530 Subject: 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 status detail'). BUG: 1410071 Signed-off-by: SonaArora Change-Id: I1a39241a4a5d70c20b2326599b3cccd8f1f6dc78 Reviewed-on: http://review.gluster.org/16347 Smoke: Gluster Build System Tested-by: Kotresh HR NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System Reviewed-by: Kotresh HR --- cli/src/cli-cmd-parser.c | 40 ++++++++++++++++++---------------------- 1 file changed, 18 insertions(+), 22 deletions(-) (limited to 'cli') 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; -- cgit