mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Use correct property name (#51511)
Add missing variable for storing returned file object. This prevents an I/O error because the f.writelines() call will be against a closed file.
This commit is contained in:
parent
0be66113d4
commit
55436fde26
1 changed files with 2 additions and 2 deletions
|
@ -1909,7 +1909,7 @@ class SunOS(User):
|
|||
fields[5] = str(int(warnweeks) * 7)
|
||||
line = ':'.join(fields)
|
||||
lines.append('%s\n' % line)
|
||||
with open(self.SHADOWFILE, 'w+'):
|
||||
with open(self.SHADOWFILE, 'w+') as f:
|
||||
f.writelines(lines)
|
||||
rc = 0
|
||||
except Exception as err:
|
||||
|
@ -1928,7 +1928,7 @@ class SunOS(User):
|
|||
with open(self.USER_ATTR, 'r') as file_handler:
|
||||
for line in file_handler:
|
||||
lines = line.strip().split('::::')
|
||||
if lines[0] == self.user:
|
||||
if lines[0] == self.name:
|
||||
tmp = dict(x.split('=') for x in lines[1].split(';'))
|
||||
info[0] = tmp.get('profiles', '')
|
||||
info[1] = tmp.get('auths', '')
|
||||
|
|
Loading…
Reference in a new issue