The python module import error in semanage_migrate_store was misleading.
Before, it would print that the module is not installed, even though
it is in fact on the system.

Now the python module import failure is correctly reported if the module
is not installed or the exact reason for failure is reported to the user.

Signed-off-by: Yuli Khodorkovskiy <[email protected]>
---
 libsemanage/utils/semanage_migrate_store | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libsemanage/utils/semanage_migrate_store 
b/libsemanage/utils/semanage_migrate_store
index 2e6cb278..50eb59ef 100755
--- a/libsemanage/utils/semanage_migrate_store
+++ b/libsemanage/utils/semanage_migrate_store
@@ -15,10 +15,12 @@ sepol = ctypes.cdll.LoadLibrary('libsepol.so.1')
 try:
        import selinux
        import semanage
-except:
+except ImportError:
        print("You must install libselinux-python and libsemanage-python before 
running this tool", file=sys.stderr)
        exit(1)
-
+except Exception as e:
+       print("Failed to import libselinux-python/libsemanage-python: %s" % 
str(e))
+       exit(1)
 
 def copy_file(src, dst):
        if DEBUG:
-- 
2.19.0

_______________________________________________
Selinux mailing list
[email protected]
To unsubscribe, send email to [email protected].
To get help, send an email containing "help" to [email protected].

Reply via email to