From 5e8413ecb6c0da64265fb2183cb80c646b2e6e0f Mon Sep 17 00:00:00 2001 From: Daniel Mach Date: Tue, 21 Jun 2022 08:33:38 +0200 Subject: [PATCH] Don't traceback on invalid credentials manager --- osc/credentials.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/osc/credentials.py b/osc/credentials.py index 717bf20e..fa4ab925 100644 --- a/osc/credentials.py +++ b/osc/credentials.py @@ -413,7 +413,12 @@ def create_credentials_manager(url, cp): creds_mgr_cls = config_entry options = None mod, cls = creds_mgr_cls.rsplit('.', 1) - return getattr(importlib.import_module(mod), cls).create(cp, options) + try: + creds_mgr = getattr(importlib.import_module(mod), cls).create(cp, options) + except ModuleNotFoundError: + msg = "Invalid credentials_mgr_class: {}".format(creds_mgr_cls) + raise oscerr.ConfigError(msg, conf.config['conffile']) + return creds_mgr def qualified_name(obj):