diff options
| author | Zuul <zuul@review.openstack.org> | 2017-11-08 05:17:21 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2017-11-08 05:17:21 +0000 |
| commit | b230ba73cdfd91e07fe168ee46a928f5556fad55 (patch) | |
| tree | 3a104f57d5a684129bd583fe40782c792cf95c2b | |
| parent | 5311fc36fd4b036ce5a6a88c223ae4850d0fedff (diff) | |
| parent | 599fa782623598208c012125dd988a48774cfc6e (diff) | |
| download | python-openstackclient-b230ba73cdfd91e07fe168ee46a928f5556fad55.tar.gz | |
Merge "Be robust on import plugin module"
| -rw-r--r-- | openstackclient/common/clientmanager.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/openstackclient/common/clientmanager.py b/openstackclient/common/clientmanager.py index ea581696..7b2c8a5c 100644 --- a/openstackclient/common/clientmanager.py +++ b/openstackclient/common/clientmanager.py @@ -134,7 +134,13 @@ def get_plugin_modules(group): for ep in pkg_resources.iter_entry_points(group): LOG.debug('Found plugin %r', ep.name) - __import__(ep.module_name) + try: + __import__(ep.module_name) + except Exception: + sys.stderr.write( + "WARNING: Failed to import plugin %r.\n" % ep.name) + continue + module = sys.modules[ep.module_name] mod_list.append(module) init_func = getattr(module, 'Initialize', None) |
