diff options
author | Aravinda VK <avishwan@redhat.com> | 2017-06-06 17:59:59 +0530 |
---|---|---|
committer | Aravinda VK <avishwan@redhat.com> | 2017-06-08 11:16:20 +0000 |
commit | 513984ad90531c53fcb7d6f0d581f198a6afcf93 (patch) | |
tree | 1c2b53f77bd1955c73e5659f8b5bc3dc0b030ad2 | |
parent | 0a07cffbf363e35e9617e5d4ef605f26ede06f05 (diff) |
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 <avishwan@redhat.com>
Reviewed-on: https://review.gluster.org/17489
Smoke: Gluster Build System <jenkins@build.gluster.org>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Kotresh HR <khiremat@redhat.com>
-rw-r--r-- | geo-replication/syncdaemon/configinterface.py | 6 |
1 files changed, 6 insertions, 0 deletions
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): |