extract read_config_files util for config parsing

This commit is contained in:
Yu Ming Zhu 2019-02-17 15:27:49 +00:00 committed by Tomas Kopecek
parent d5f67d648a
commit 4c1928f377
18 changed files with 300 additions and 251 deletions

View file

@ -20,7 +20,6 @@
from __future__ import absolute_import
from __future__ import division
from six.moves.configparser import RawConfigParser
import datetime
import inspect
import logging
@ -399,17 +398,8 @@ def load_config(environ):
#get our config file(s)
cf = environ.get('koji.hub.ConfigFile', '/etc/koji-hub/hub.conf')
cfdir = environ.get('koji.hub.ConfigDir', '/etc/koji-hub/hub.conf.d')
if cfdir:
configs = koji.config_directory_contents(cfdir)
else:
configs = []
if cf and os.path.isfile(cf):
configs.append(cf)
if configs:
config = RawConfigParser()
config.read(configs)
else:
config = None
config = koji.read_config_files([cfdir, cf], raw=True, strict=True)
cfgmap = [
#option, type, default
['DBName', 'string', None],