Currently, the utility function import_site_symbol prints
an INFO message every time a site module cannot be imported.
However, for cases where we don't have an actual site_*.py
present, the message is not necessary. Right now users using
the vanilla version of autotest see this at every client or
server execution:
INFO:root:unable to import site module 'site_packages.py', using non-site implementation
INFO:root:unable to import site module 'site_sysinfo.py', using non-site implementation
INFO:root:unable to import site module 'site_kernel.py', using non-site implementation
INFO:root:unable to import site module 'site_job.py', using non-site implementation
When there is a file present though, we should be louder
complaining (an existing site module might have syntax problems
or other issues). So, supress messages when we don't have a
site file, and when we do, make it an ERROR message.
Fixing patch according to John's comments.
Signed-off-by: Lucas Meneghel Rodrigues <lmr@redhat.com>
git-svn-id: http://test.kernel.org/svn/autotest/trunk@3524 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/client/common_lib/utils.py b/client/common_lib/utils.py
index a1161d1..fd0175f 100644
--- a/client/common_lib/utils.py
+++ b/client/common_lib/utils.py
@@ -904,12 +904,9 @@
if obj is cant_import:
msg = ("unable to import site symbol '%s', using non-site "
"implementation") % name
+ logging.error(msg)
+ obj = dummy
else:
- msg = "unable to import site module '%s', using non-site implementation"
- msg %= modulefile
-
- if msg:
- logging.info(msg)
obj = dummy
return obj