summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorCsaba Henk <csaba@gluster.com>2011-02-14 10:57:59 +0000
committerAnand V. Avati <avati@dev.gluster.com>2011-02-14 14:02:23 -0800
commit653a46850d765ca00a76452c76950ed60ab967d3 (patch)
tree74ef24bc37c961b2e3a0c07664ebea7b36f7cff7 /xlators
parent1b04647157079d35851e206b8e9572960b2de214 (diff)
syncdaemon: make configparser code work with all supported python versions
Signed-off-by: Csaba Henk <csaba@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 1570 (geosync related changes) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1570
Diffstat (limited to 'xlators')
-rw-r--r--xlators/features/marker/utils/syncdaemon/configinterface.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/xlators/features/marker/utils/syncdaemon/configinterface.py b/xlators/features/marker/utils/syncdaemon/configinterface.py
index 269bbde67fc..25a2a526818 100644
--- a/xlators/features/marker/utils/syncdaemon/configinterface.py
+++ b/xlators/features/marker/utils/syncdaemon/configinterface.py
@@ -1,4 +1,9 @@
-import ConfigParser
+try:
+ import ConfigParser
+except ImportError:
+ # py 3
+ import configparser as ConfigParser
+
DEF_SECT = 'global'
@@ -10,17 +15,18 @@ class GConffile(object):
else:
self.section = DEF_SECT
self.path = path
- self.config = ConfigParser.RawConfigParser({}, dict)
+ self.config = ConfigParser.RawConfigParser()
self.config.read(path)
def update_to(self, dct):
for sect in set([DEF_SECT, self.section]):
if self.config.has_section(sect):
- for k, v in self.config._sections[sect].iteritems():
+ for k, v in self.config._sections[sect].items():
if k == '__name__':
continue
k = k.replace('-', '_')
dct[k] = v
+
def get(self, opt=None):
d = {}
self.update_to(d)