Proper way to handle errors from python restorecon binding?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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]
--
_______________________________________________
selinux mailing list -- selinux@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to selinux-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/selinux@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue




[Index of Archives]     [Fedora Users]     [Fedora Desktop]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux