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