Log message around import failure

In certain cases import failure is
expected and in certain cases it is
not expected, in either case it is
useful to at least log the failure.
This commit is contained in:
Joshua Harlow 2013-10-09 12:22:06 -07:00
parent 75a493f9f0
commit a48fc7e2ca

View File

@ -36,6 +36,7 @@ def find_module(base_name, search_paths, required_attrs=None):
found_places = []
if not required_attrs:
required_attrs = []
# NOTE(harlowja): translate the search paths to include the base name.
real_paths = []
for path in search_paths:
real_path = []
@ -50,8 +51,9 @@ def find_module(base_name, search_paths, required_attrs=None):
mod = None
try:
mod = import_module(full_path)
except ImportError:
pass
except ImportError as e:
LOG.debug("Failed at attempted import of '%s' due to: %s",
full_path, e)
if not mod:
continue
found_attrs = 0