mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-24 13:50:22 -07:00
Fix dead code in files module (#43479)
* Use pwd.getpwnam instead of non-existent pwd.getpwname * Add specific exceptions to pwd and grp calls
This commit is contained in:
parent
cf1006179d
commit
cd5d484f7a
2 changed files with 11 additions and 11 deletions
|
@ -496,13 +496,13 @@ def main():
|
|||
try: # user data
|
||||
pw = pwd.getpwuid(st.st_uid)
|
||||
output['pw_name'] = pw.pw_name
|
||||
except:
|
||||
except (TypeError, KeyError):
|
||||
pass
|
||||
|
||||
try: # group data
|
||||
grp_info = grp.getgrgid(st.st_gid)
|
||||
output['gr_name'] = grp_info.gr_name
|
||||
except:
|
||||
except (KeyError, ValueError, OverflowError):
|
||||
pass
|
||||
|
||||
# checksums
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue