21ab4e
From eaa1f5a1f4d319d1fd2eec2e54abccc034aff326 Mon Sep 17 00:00:00 2001
21ab4e
From: Aravinda VK <avishwan@redhat.com>
21ab4e
Date: Tue, 6 Jun 2017 17:59:59 +0530
21ab4e
Subject: [PATCH 498/509] geo-rep: Fix ConfigInterface Template issue
21ab4e
21ab4e
ConfigParser uses string Template to substitute the dynamic values
21ab4e
for config. For some of the configurations, Geo-rep worker will
21ab4e
not restart. Due to this conf object may have non string values.
21ab4e
21ab4e
If val is not string in Template(val), then it fails with
21ab4e
"TypeError: expected string or buffer"
21ab4e
21ab4e
> Reviewed-on: https://review.gluster.org/17489
21ab4e
> Smoke: Gluster Build System <jenkins@build.gluster.org>
21ab4e
> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
21ab4e
> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
21ab4e
> Reviewed-by: Kotresh HR <khiremat@redhat.com>
21ab4e
21ab4e
BUG: 1448386
21ab4e
Change-Id: I25b8bbc1df42f6f29e9563a55b3e27a228321c44
21ab4e
Signed-off-by: Aravinda VK <avishwan@redhat.com>
21ab4e
Reviewed-on: https://code.engineering.redhat.com/gerrit/108895
21ab4e
Reviewed-by: Kotresh Hiremath Ravishankar <khiremat@redhat.com>
21ab4e
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
21ab4e
---
21ab4e
 geo-replication/syncdaemon/configinterface.py | 6 ++++++
21ab4e
 1 file changed, 6 insertions(+)
21ab4e
21ab4e
diff --git a/geo-replication/syncdaemon/configinterface.py b/geo-replication/syncdaemon/configinterface.py
21ab4e
index 50e7aed..95c153e 100644
21ab4e
--- a/geo-replication/syncdaemon/configinterface.py
21ab4e
+++ b/geo-replication/syncdaemon/configinterface.py
21ab4e
@@ -337,12 +337,18 @@ class GConffile(object):
21ab4e
 
21ab4e
         def update_from_sect(sect, mud):
21ab4e
             for k, v in self.config._sections[sect].items():
21ab4e
+                # Template expects String to be passed
21ab4e
+                # if any config value is not string then it
21ab4e
+                # fails with ValueError
21ab4e
+                v = u"{0}".format(v)
21ab4e
+
21ab4e
                 if k == '__name__':
21ab4e
                     continue
21ab4e
                 if allow_unresolved:
21ab4e
                     dct[k] = Template(v).safe_substitute(mud)
21ab4e
                 else:
21ab4e
                     dct[k] = Template(v).substitute(mud)
21ab4e
+
21ab4e
         for sect in self.ord_sections():
21ab4e
             sp = self.parse_section(sect)
21ab4e
             if isinstance(sp[0], re_type) and len(sp) == len(self.peers):
21ab4e
-- 
21ab4e
1.8.3.1
21ab4e