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