def _load_config(self, config_files, profile):
"""Initialize client settings from config."""
for filename in config_files:
try:
with open(os.path.expanduser(filename), 'r') as f:
config = yaml.safe_load(f.read())
return config.get(profile, {})
except IOError:
logging.debug('{0} config file not found.'.format(filename))
pass
except yaml.YAMLError as e:
msg = 'Failed to parse {0}: {1}'.format(filename, e)
logging.error(msg)
raise ClientConfigurationError(msg)
# No file found
return {}
评论列表
文章目录