Proper way to handle errors from python restorecon binding?
by Brian J. Murrell
It's not clear to me in which ways the restorecon() python binding can return an error/failure?
Can it raise an exception or does it always simply report errors in it's return code? I.e. I need to do:
rc = selinux.restorecon(path)
if rc != 0:
[error handling]
And/or do I need a try/except block around restorecon() as something it calls could raise an exception?
I have seen reference to code that calls it as such:
try:
selinux.restorecon(path)
except selinux.SELinuxError:
[error handling]
1 week, 5 days