mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
On FreeBSD apply 'login_class' only if there is real change.
This commit is contained in:
parent
657d9d1f25
commit
845b6d78be
1 changed files with 11 additions and 2 deletions
|
@ -797,6 +797,15 @@ class FreeBsdUser(User):
|
|||
cmd.append(self.shell)
|
||||
|
||||
if self.login_class is not None:
|
||||
# find current login class
|
||||
user_login_class = None
|
||||
if os.path.exists(self.SHADOWFILE) and os.access(self.SHADOWFILE, os.R_OK):
|
||||
for line in open(self.SHADOWFILE).readlines():
|
||||
if line.startswith('%s:' % self.name):
|
||||
user_login_class = line.split(':')[4]
|
||||
|
||||
# act only if login_class change
|
||||
if self.login_class != user_login_class:
|
||||
cmd.append('-L')
|
||||
cmd.append(self.login_class)
|
||||
|
||||
|
|
Loading…
Reference in a new issue