From 7aa8cfa4f0292257568e6fc766c0fcc8d35b0b96 Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Wed, 20 Jun 2012 16:32:50 -0700 Subject: 1. Show what we are importing 2. Don't rethrow as a runtime exception, let people using this just catch the real error... --- cloudinit/importer.py | 12 ++++++++++-- 1 file 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 -- cgit v1.2.3