diff options
author | Joshua Harlow <harlowja@yahoo-inc.com> | 2012-06-20 16:32:50 -0700 |
---|---|---|
committer | Joshua Harlow <harlowja@yahoo-inc.com> | 2012-06-20 16:32:50 -0700 |
commit | 7aa8cfa4f0292257568e6fc766c0fcc8d35b0b96 (patch) | |
tree | ae8b4409e13e82ecea4730713144f48eca0044e9 /cloudinit | |
parent | 2d4b57a6d12227ad03658e4b5d812c6fdca42049 (diff) | |
download | vyos-cloud-init-7aa8cfa4f0292257568e6fc766c0fcc8d35b0b96.tar.gz vyos-cloud-init-7aa8cfa4f0292257568e6fc766c0fcc8d35b0b96.zip |
1. Show what we are importing
2. Don't rethrow as a runtime exception, let people using this just catch the real error...
Diffstat (limited to 'cloudinit')
-rw-r--r-- | cloudinit/importer.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/cloudinit/importer.py b/cloudinit/importer.py index 0344d0de..a36b87bc 100644 --- a/cloudinit/importer.py +++ b/cloudinit/importer.py @@ -22,10 +22,18 @@ import sys +from cloudinit import log as logging +from cloudinit import util +LOG = logging.getLogger(__name__) + + +# Simple wrapper that allows us to add more logging in... def import_module(module_name): try: + LOG.debug("Attempting to import module %s", module_name) __import__(module_name) return sys.modules[module_name] - except ImportError as err: - raise RuntimeError('Could not load module %s: %s' % (module_name, err)) + except: + util.logexc(LOG, 'Failed at importing %s', module_name) + raise |