sysrc: remove re import and set errno.EACCES on the OSError

This commit is contained in:
David Lundgren 2025-07-18 09:53:35 -05:00
commit 89bba88211
No known key found for this signature in database
GPG key ID: 2B78584C498D2A5E

View file

@ -106,7 +106,6 @@ from ansible_collections.community.general.plugins.module_utils.module_helper im
import errno
import os
import re
class Sysrc(StateModuleHelper):
module = dict(
@ -162,7 +161,7 @@ class Sysrc(StateModuleHelper):
(rc, out, err) = self.module.run_command(cmd)
if "Permission denied" in err:
raise OSError("Permission denied for %s" % self.path)
raise OSError(errno.EACCES, "Permission denied for %s" % self.path)
return (rc, out, err)