diff mbox series

[v2,1/1] libsemanage: improve semanage_migrate_store import failure

Message ID 20181011134333.16468-2-yuli@crunchydata.com (mailing list archive)
State Not Applicable
Headers show
Series Modify exception handling in semanage_migrate_store | expand

Commit Message

Yuli Khodorkovskiy Oct. 11, 2018, 1:43 p.m. UTC
From: Yuli Khodorkovskiy <yuli.khodorkovskiy@crunchydata.com>

The selinux/semanage python module import error in semanage_migrate_store
was misleading. Before, it would report that the selinux/semanage modules
were not installed even though they were on the system.

Now the import failure is only reported if the modules are not installed.
Otherwise, a stack trace is printed for all other errors in the selinux/semanage
python modules.

Signed-off-by: Yuli Khodorkovskiy <yuli.khodorkovskiy@crunchydata.com>
---
 libsemanage/utils/semanage_migrate_store | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/libsemanage/utils/semanage_migrate_store b/libsemanage/utils/semanage_migrate_store
index 2e6cb278..b789d042 100755
--- a/libsemanage/utils/semanage_migrate_store
+++ b/libsemanage/utils/semanage_migrate_store
@@ -15,7 +15,7 @@  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)