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