d2787b
From 1c7e96e73273b7891ea6ef0d768c2bf7ff5de7b0 Mon Sep 17 00:00:00 2001
d2787b
From: Shwetha K Acharya <sacharya@redhat.com>
d2787b
Date: Thu, 4 Feb 2021 16:29:39 +0530
d2787b
Subject: [PATCH 529/532] geo-rep: prompt should work for ignore_deletes
d2787b
d2787b
The python cli is intelligent enough to parse both "-" and "_" alike:
d2787b
d2787b
Example:
d2787b
geo-replication config updated successfully
d2787b
sync_job 4
d2787b
geo-replication config updated successfully
d2787b
gluster volume geo-replication primary 127.0.0.1::secondary config | grep sync_jobs
d2787b
sync_jobs:5
d2787b
d2787b
Thus the prompt which appears after ignore-deletes true should
d2787b
work for both ignore-deletes and ignore_deletes.
d2787b
d2787b
Label: DOWNSTREAM ONLY
d2787b
d2787b
BUG: 1224906
d2787b
Change-Id: I89f854200a604d07d3ac6c374fe6d445ce9f22ca
d2787b
Signed-off-by: Shwetha K Acharya <sacharya@redhat.com>
d2787b
Reviewed-on: https://code.engineering.redhat.com/gerrit/226599
d2787b
Tested-by: RHGS Build Bot <nigelb@redhat.com>
d2787b
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
d2787b
---
d2787b
 cli/src/cli-cmd-parser.c       |  5 +++--
d2787b
 tests/00-geo-rep/bug-1708603.t | 12 ++++++++++--
d2787b
 2 files changed, 13 insertions(+), 4 deletions(-)
d2787b
d2787b
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
d2787b
index 34f17c9..dda8979 100644
d2787b
--- a/cli/src/cli-cmd-parser.c
d2787b
+++ b/cli/src/cli-cmd-parser.c
d2787b
@@ -3107,8 +3107,9 @@ cli_cmd_gsync_set_parse(struct cli_state *state, const char **words,
d2787b
     if (!ret)
d2787b
         ret = dict_set_int32(dict, "type", type);
d2787b
     if (!ret && type == GF_GSYNC_OPTION_TYPE_CONFIG) {
d2787b
-        if (!strcmp((char *)words[wordcount - 2], "ignore-deletes") &&
d2787b
-            !strcmp((char *)words[wordcount - 1], "true")) {
d2787b
+        if ((((!strcmp((char *)words[wordcount - 2], "ignore_deletes")) ||
d2787b
+              (!strcmp((char *)words[wordcount - 2], "ignore-deletes")))) &&
d2787b
+            ((!strcmp((char *)words[wordcount - 1], "true")))) {
d2787b
             question =
d2787b
                 "There exists ~15 seconds delay for the option to take"
d2787b
                 " effect from stime of the corresponding brick. Please"
d2787b
diff --git a/tests/00-geo-rep/bug-1708603.t b/tests/00-geo-rep/bug-1708603.t
d2787b
index 26913f1..edafb48 100644
d2787b
--- a/tests/00-geo-rep/bug-1708603.t
d2787b
+++ b/tests/00-geo-rep/bug-1708603.t
d2787b
@@ -44,11 +44,19 @@ TEST glusterfs -s $H0 --volfile-id $GSV0 $M1
d2787b
 #Create geo-rep session
d2787b
 TEST create_georep_session $master $slave
d2787b
 
d2787b
-echo n | $GEOREP_CLI $master $slave config ignore-deletes true >/dev/null 2>&1
d2787b
-EXPECT "false" echo $($GEOREP_CLI $master $slave config ignore-deletes)
d2787b
+echo n | $GEOREP_CLI $master $slave config ignore_deletes true >/dev/null 2>&1
d2787b
+EXPECT "false" echo $($GEOREP_CLI $master $slave config ignore_deletes)
d2787b
+
d2787b
+echo y | $GEOREP_CLI $master $slave config ignore_deletes true
d2787b
+EXPECT "true" echo $($GEOREP_CLI $master $slave config ignore_deletes)
d2787b
+
d2787b
+$GEOREP_CLI $master $slave config ignore_deletes false
d2787b
 echo y | $GEOREP_CLI $master $slave config ignore-deletes true
d2787b
 EXPECT "true" echo $($GEOREP_CLI $master $slave config ignore-deletes)
d2787b
 
d2787b
+echo n | $GEOREP_CLI $master $slave config ignore-deletes true >/dev/null 2>&1
d2787b
+EXPECT "true" echo $($GEOREP_CLI $master $slave config ignore-deletes)
d2787b
+
d2787b
 #Stop Geo-rep
d2787b
 TEST $GEOREP_CLI $master $slave stop
d2787b
 
d2787b
-- 
d2787b
1.8.3.1
d2787b