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>
This commit is contained in:
parent
7f5d1ab2b7
commit
af0d70cb6f
2 changed files with 3 additions and 1 deletions
2
changelogs/fragments/user_missing_etc_shadow.yml
Normal file
2
changelogs/fragments/user_missing_etc_shadow.yml
Normal file
|
@ -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
|
||||
# Due to absence of PermissionError in python2.7 need to check
|
||||
# errno
|
||||
if e.errno in (errno.EACCES, errno.EPERM):
|
||||
if e.errno in (errno.EACCES, errno.EPERM, errno.ENOENT):
|
||||
return passwd, expires
|
||||
raise
|
||||
|
||||
|
|
Loading…
Reference in a new issue