Skip to content

Commit 599fa78

Browse files
committed
Be robust on import plugin module
On loading external plugin, OSC should be robust on importing the plugin module so that commands from other modules can continue to execute. Closes-Bug: #1722008 Change-Id: Ibe716681c7f78fabee31b7ef281af2588d68ab30
1 parent a87bd58 commit 599fa78

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

openstackclient/common/clientmanager.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,13 @@ def get_plugin_modules(group):
134134
for ep in pkg_resources.iter_entry_points(group):
135135
LOG.debug('Found plugin %r', ep.name)
136136

137-
__import__(ep.module_name)
137+
try:
138+
__import__(ep.module_name)
139+
except Exception:
140+
sys.stderr.write(
141+
"WARNING: Failed to import plugin %r.\n" % ep.name)
142+
continue
143+
138144
module = sys.modules[ep.module_name]
139145
mod_list.append(module)
140146
init_func = getattr(module, 'Initialize', None)

0 commit comments

Comments
 (0)