mirror of
https://github.com/SELinuxProject/selinux
synced 2024-12-25 15:32:07 +00:00
be065c4b44
When a policy is inaccessible, scripts fail right "import sepolicy". With this change we let the "sepolicy" module to import and move the policy initialization before it's used for the first time. Fixes: >>> import seobject Traceback (most recent call last): File "/usr/lib/python3.9/site-packages/sepolicy/__init__.py", line 171, in policy _pol = setools.SELinuxPolicy(policy_file) File "setools/policyrep/selinuxpolicy.pxi", line 73, in setools.policyrep.SELinuxPolicy.__cinit__ File "setools/policyrep/selinuxpolicy.pxi", line 695, in setools.policyrep.SELinuxPolicy._load_policy PermissionError: [Errno 13] Permission denied: '//etc/selinux/targeted/policy/policy.33' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python3.9/site-packages/seobject.py", line 33, in <module> import sepolicy File "/usr/lib/python3.9/site-packages/sepolicy/__init__.py", line 186, in <module> raise e File "/usr/lib/python3.9/site-packages/sepolicy/__init__.py", line 183, in <module> policy(policy_file) File "/usr/lib/python3.9/site-packages/sepolicy/__init__.py", line 173, in policy raise ValueError(_("Failed to read %s policy file") % policy_file) ValueError: Failed to read //etc/selinux/targeted/policy/policy.33 policy file Signed-off-by: Petr Lautrbach <plautrba@redhat.com> |
||
---|---|---|
.. | ||
ru | ||
sepolicy | ||
.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 |