[master][PATCH] Raise exception if our module fails to be imported

Vratislav Podzimek vpodzime at redhat.com
Mon Apr 22 11:37:27 UTC 2013


If an addon or something like that fails to be imported we may want to just log
an error, but if an import of our own module fails it is a bug.

Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
---
 pyanaconda/ui/common.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/pyanaconda/ui/common.py b/pyanaconda/ui/common.py
index 2bae250..bc1009e 100644
--- a/pyanaconda/ui/common.py
+++ b/pyanaconda/ui/common.py
@@ -567,8 +567,11 @@ def collect(module_pattern, path, pred):
             # skip the file as well
             if not module_flags[0].startswith(".py") and loaded_ext.startswith(".py"):
                 continue
-            
+
         except ImportError as imperr:
+            if "pyanaconda" in module_path:
+                # failure when importing our own module:
+                raise
             log.error("Failed to import module in collect: %s" % imperr)
             continue
         finally:
-- 
1.7.11.7



More information about the anaconda-patches mailing list