user: Handle exception when /etc/shadow file is missing (#63888)

Added exception handling when module tries to modify user details,
and /etc/shadow file is missing or not found.

Fixes: #63490

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
pull/63928/head
Abhijeet Kasurde 5 years ago committed by Matt Martz
parent 7f5d1ab2b7
commit af0d70cb6f

@ -0,0 +1,2 @@
bugfixes:
- Handle exception when /etc/shadow file is missing or not found, while operating user operation in user module (https://github.com/ansible/ansible/issues/63490).

@ -911,7 +911,7 @@ class User(object):
# Python 3.6 raises PermissionError instead of KeyError # Python 3.6 raises PermissionError instead of KeyError
# Due to absence of PermissionError in python2.7 need to check # Due to absence of PermissionError in python2.7 need to check
# errno # errno
if e.errno in (errno.EACCES, errno.EPERM): if e.errno in (errno.EACCES, errno.EPERM, errno.ENOENT):
return passwd, expires return passwd, expires
raise raise

Loading…
Cancel
Save