selinux/python/sepolicy
Nicolas Iooss 8f0ea463bc sepolicy: do not fail when file_contexts.local or .subs do not exist
On a system without any file context customizations, "sepolicy gui"
fails to load because it tries to read a non-existing file:

    FileNotFoundError: [Errno 2] No such file or directory:
    '/etc/selinux/refpolicy-git/contexts/files/file_contexts.local'

Once this issue is fixed, another one is triggered:

    FileNotFoundError: [Errno 2] No such file or directory:
    '/etc/selinux/refpolicy-git/contexts/files/file_contexts.subs

Use try/except to catch these exceptions and use OSError/errno.ENOENT to
keep the code compatible with Python 2.

Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
2017-09-21 16:15:54 -04:00
..
sepolicy sepolicy: do not fail when file_contexts.local or .subs do not exist 2017-09-21 16:15:54 -04:00
.gitignore
Makefile
sepolgen.8
sepolicy-bash-completion.sh
sepolicy-booleans.8
sepolicy-communicate.8
sepolicy-generate.8
sepolicy-gui.8
sepolicy-interface.8
sepolicy-manpage.8
sepolicy-network.8
sepolicy-transition.8
sepolicy.8
sepolicy.py
setup.py
test_sepolicy.py