diff options
| author | Russell Bryant <rbryant@redhat.com> | 2012-07-13 12:10:48 -0400 |
|---|---|---|
| committer | Russell Bryant <rbryant@redhat.com> | 2012-07-13 12:14:54 -0400 |
| commit | 43677fc6dab76d9b6ad0375eba4b3c2a78e5b405 (patch) | |
| tree | 40036f71cf8abccada68bafe326597cfb3a471fa /nova/openstack | |
| parent | c6c29ab3898a88144f022aaefd1e8267e4dbb866 (diff) | |
| download | nova-43677fc6dab76d9b6ad0375eba4b3c2a78e5b405.tar.gz nova-43677fc6dab76d9b6ad0375eba4b3c2a78e5b405.tar.xz nova-43677fc6dab76d9b6ad0375eba4b3c2a78e5b405.zip | |
Sync importutils from openstack-common.
commit 8c74b37f5bdf1141b8c3724c8df460e6562d1985
Author: Russell Bryant <rbryant@redhat.com>
Date: Tue Jun 19 17:08:35 2012 -0400
Improve exception from importutils.import_class().
The ImportError raised by import_class() attempted to tell you what the
original error was by just doing str() on the original exception.
Sometimes that's helpful, but sometimes a full traceback is needed.
This patch includes a traceback for debugging purposes.
Change-Id: I83b167baf99feacef1a3f91089b758c6cf9531d3
Diffstat (limited to 'nova/openstack')
| -rw-r--r-- | nova/openstack/common/importutils.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/nova/openstack/common/importutils.py b/nova/openstack/common/importutils.py index 67d94ad5f..2fbb0291a 100644 --- a/nova/openstack/common/importutils.py +++ b/nova/openstack/common/importutils.py @@ -20,6 +20,7 @@ Import related utilities and helper functions. """ import sys +import traceback def import_class(import_str): @@ -30,7 +31,8 @@ def import_class(import_str): return getattr(sys.modules[mod_str], class_str) except (ImportError, ValueError, AttributeError), exc: raise ImportError('Class %s cannot be found (%s)' % - (class_str, str(exc))) + (class_str, + traceback.format_exception(*sys.exc_info()))) def import_object(import_str, *args, **kwargs): |
