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