Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _try_load_config(main_section, interactive=False):
try:
return load_config(main_section, interactive)
except IOError:
# Our standard logging configuration depends on the bugwarrior
# configuration file which just failed to load.
logging.basicConfig()
exc_info = sys.exc_info()
log.critical("Could not load configuration. "
"Maybe you have not created a configuration file.",
exc_info=(exc_info[0], exc_info[1], None))
sys.exit(1)
def targets():
config = load_config('general')
for section in config.sections():
if section in ['general', 'notifications'] or \
section.startswith('flavor.'):
continue
service_name = config.get(section, 'service')
service_class = get_service(service_name)
for option in config.options(section):
value = config.get(section, option)
if not value:
continue
if '@oracle:use_keyring' in value:
service_config = ServiceConfig(
service_class.CONFIG_PREFIX, config, section)
yield service_class.get_keyring_service(service_config)