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>
This commit is contained in:
parent
0a07cffbf3
commit
513984ad90
@ -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):
|
||||
|
Loading…
x
Reference in New Issue
Block a user