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