74b1de
From 98c9fc8d774ae153ca6b44d3337cf5d9f7a030e2 Mon Sep 17 00:00:00 2001
74b1de
From: Kotresh HR <khiremat@redhat.com>
74b1de
Date: Fri, 16 Aug 2019 16:07:03 +0530
74b1de
Subject: [PATCH 282/284] geo-rep: Fix the name of changelog archive file
74b1de
74b1de
Background:
74b1de
The processed changelogs are archived each month in a single tar file.
74b1de
The default format is "archive_YYYYMM.tar" which is specified as "%%Y%%m"
74b1de
in configuration file.
74b1de
74b1de
Problem:
74b1de
The created changelog archive file didn't have corresponding year
74b1de
and month. It created as "archive_%Y%m.tar" on python2 only systems.
74b1de
74b1de
Cause and Fix:
74b1de
Geo-rep expects "%Y%m" after the ConfigParser reads it from config file.
74b1de
Since it was "%%Y%%m" in config file, geo-rep used to get correct value
74b1de
"%Y%m" in python3 and "%%Y%%m" in python2 which is incorrect.
74b1de
The fix can be to use "%Y%m" in config file but that fails in python3.
74b1de
So the fix is to use "RawConfigParser" in geo-rep and use "%Y%m". This
74b1de
works both in python2 and python3.
74b1de
74b1de
Backport of:
74b1de
 > Patch: https://review.gluster.org/23248
74b1de
 > Change-Id: Ie5b7d2bc04d0d53cd1769e064c2d67aaf95d557c
74b1de
 > fixes: bz#1741890
74b1de
 > Signed-off-by: Kotresh HR <khiremat@redhat.com>
74b1de
74b1de
Change-Id: Ie5b7d2bc04d0d53cd1769e064c2d67aaf95d557c
74b1de
BUG: 1743634
74b1de
Signed-off-by: Kotresh HR <khiremat@redhat.com>
74b1de
Reviewed-on: https://code.engineering.redhat.com/gerrit/179188
74b1de
Tested-by: RHGS Build Bot <nigelb@redhat.com>
74b1de
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
74b1de
---
74b1de
 geo-replication/gsyncd.conf.in             |  2 +-
74b1de
 geo-replication/syncdaemon/gsyncdconfig.py | 14 +++++++-------
74b1de
 2 files changed, 8 insertions(+), 8 deletions(-)
74b1de
74b1de
diff --git a/geo-replication/gsyncd.conf.in b/geo-replication/gsyncd.conf.in
74b1de
index c2e4f0d..5ebd57a 100644
74b1de
--- a/geo-replication/gsyncd.conf.in
74b1de
+++ b/geo-replication/gsyncd.conf.in
74b1de
@@ -109,7 +109,7 @@ type=int
74b1de
 help=Minimum time interval in seconds for passive worker to become Active
74b1de
 
74b1de
 [changelog-archive-format]
74b1de
-value=%%Y%%m
74b1de
+value=%Y%m
74b1de
 help=Processed changelogs will be archived in working directory. Pattern for archive file
74b1de
 
74b1de
 [use-meta-volume]
74b1de
diff --git a/geo-replication/syncdaemon/gsyncdconfig.py b/geo-replication/syncdaemon/gsyncdconfig.py
74b1de
index 38f3594..f823311 100644
74b1de
--- a/geo-replication/syncdaemon/gsyncdconfig.py
74b1de
+++ b/geo-replication/syncdaemon/gsyncdconfig.py
74b1de
@@ -10,9 +10,9 @@
74b1de
 #
74b1de
 
74b1de
 try:
74b1de
-    from ConfigParser import ConfigParser, NoSectionError
74b1de
+    from ConfigParser import RawConfigParser, NoSectionError
74b1de
 except ImportError:
74b1de
-    from configparser import ConfigParser, NoSectionError
74b1de
+    from configparser import RawConfigParser, NoSectionError
74b1de
 import os
74b1de
 import shutil
74b1de
 from string import Template
74b1de
@@ -94,7 +94,7 @@ class Gconf(object):
74b1de
         if name != "all" and not self._is_configurable(name):
74b1de
             raise GconfNotConfigurable()
74b1de
 
74b1de
-        cnf = ConfigParser()
74b1de
+        cnf = RawConfigParser()
74b1de
         with open(self.custom_conf_file) as f:
74b1de
             cnf.readfp(f)
74b1de
 
74b1de
@@ -138,7 +138,7 @@ class Gconf(object):
74b1de
         if curr_val == value:
74b1de
             return True
74b1de
 
74b1de
-        cnf = ConfigParser()
74b1de
+        cnf = RawConfigParser()
74b1de
         with open(self.custom_conf_file) as f:
74b1de
             cnf.readfp(f)
74b1de
 
74b1de
@@ -178,7 +178,7 @@ class Gconf(object):
74b1de
         self.session_conf_items = []
74b1de
         self.default_values = {}
74b1de
 
74b1de
-        conf = ConfigParser()
74b1de
+        conf = RawConfigParser()
74b1de
         # Default Template config file
74b1de
         with open(self.default_conf_file) as f:
74b1de
             conf.readfp(f)
74b1de
@@ -342,7 +342,7 @@ class Gconf(object):
74b1de
         return False
74b1de
 
74b1de
 def is_config_file_old(config_file, mastervol, slavevol):
74b1de
-    cnf = ConfigParser()
74b1de
+    cnf = RawConfigParser()
74b1de
     cnf.read(config_file)
74b1de
     session_section = "peers %s %s" % (mastervol, slavevol)
74b1de
     try:
74b1de
@@ -357,7 +357,7 @@ def config_upgrade(config_file, ret):
74b1de
     shutil.copyfile(config_file, config_file_backup)
74b1de
 
74b1de
     #write a new config file
74b1de
-    config = ConfigParser()
74b1de
+    config = RawConfigParser()
74b1de
     config.add_section('vars')
74b1de
 
74b1de
     for key, value in ret.items():
74b1de
-- 
74b1de
1.8.3.1
74b1de