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