def _read_config(self):
"""
This initializes `_key_map` and _children.
"""
self._key_map = {}
self._children = []
root_dct = self.root.get_dict()
base_directory = os.path.dirname(self.root.file)
for section, contents in root_dct.iteritems():
# find all !includedir lines, add configuration to self._children and self._sectionmap
if section.startswith('!includedir'):
relative_directory = section.split(' ', 1)[1]
directory = os.path.abspath(os.path.join(base_directory, relative_directory))
# include all files in the directory
for filename in iglob(os.path.join(directory, '*.cnf')):
# order is not guaranteed, according to mysql docs
# parse every file, return parsing result
self._read_child_config(filename)
elif section.startswith('!'):
raise NotImplementedError()
评论列表
文章目录