On OpenBSD, make user module status 'changed' only if necessary when using 'login_class' parameter
This commit is contained in:
parent
6f16ea6d49
commit
fa5a448983
1 changed files with 15 additions and 2 deletions
17
system/user
17
system/user
|
@ -901,8 +901,21 @@ class OpenBSDUser(User):
|
||||||
cmd.append(self.shell)
|
cmd.append(self.shell)
|
||||||
|
|
||||||
if self.login_class is not None:
|
if self.login_class is not None:
|
||||||
cmd.append('-L')
|
# find current login class
|
||||||
cmd.append(self.login_class)
|
user_login_class = None
|
||||||
|
userinfo_cmd = [self.module.get_bin_path('userinfo', True), self.name]
|
||||||
|
(rc, out, err) = self.execute_command(userinfo_cmd)
|
||||||
|
|
||||||
|
for line in out.splitlines():
|
||||||
|
tokens = line.split()
|
||||||
|
|
||||||
|
if tokens[0] == 'class' and len(tokens) == 2:
|
||||||
|
user_login_class = tokens[1]
|
||||||
|
|
||||||
|
# act only if login_class change
|
||||||
|
if self.login_class != user_login_class:
|
||||||
|
cmd.append('-L')
|
||||||
|
cmd.append(self.login_class)
|
||||||
|
|
||||||
if self.update_password == 'always' and self.password is not None and info[1] != self.password:
|
if self.update_password == 'always' and self.password is not None and info[1] != self.password:
|
||||||
cmd.append('-p')
|
cmd.append('-p')
|
||||||
|
|
Loading…
Reference in a new issue