|
|
@ -1352,20 +1352,21 @@ class SunOS(User):
|
|
|
|
cmd.append('-s')
|
|
|
|
cmd.append('-s')
|
|
|
|
cmd.append(self.shell)
|
|
|
|
cmd.append(self.shell)
|
|
|
|
|
|
|
|
|
|
|
|
if self.module.check_mode:
|
|
|
|
# modify the user if cmd will do anything
|
|
|
|
return (0, '', '')
|
|
|
|
if cmd_len != len(cmd):
|
|
|
|
else:
|
|
|
|
(rc, out, err) = (0, '', '')
|
|
|
|
# modify the user if cmd will do anything
|
|
|
|
if not self.module.check_mode:
|
|
|
|
if cmd_len != len(cmd):
|
|
|
|
|
|
|
|
cmd.append(self.name)
|
|
|
|
cmd.append(self.name)
|
|
|
|
(rc, out, err) = self.execute_command(cmd)
|
|
|
|
(rc, out, err) = self.execute_command(cmd)
|
|
|
|
if rc is not None and rc != 0:
|
|
|
|
if rc is not None and rc != 0:
|
|
|
|
self.module.fail_json(name=self.name, msg=err, rc=rc)
|
|
|
|
self.module.fail_json(name=self.name, msg=err, rc=rc)
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
(rc, out, err) = (None, '', '')
|
|
|
|
(rc, out, err) = (None, '', '')
|
|
|
|
|
|
|
|
|
|
|
|
# we have to set the password by editing the /etc/shadow file
|
|
|
|
# we have to set the password by editing the /etc/shadow file
|
|
|
|
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:
|
|
|
|
|
|
|
|
(rc, out, err) = (0, '', '')
|
|
|
|
|
|
|
|
if not self.module.check_mode:
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
lines = []
|
|
|
|
lines = []
|
|
|
|
for line in open(self.SHADOWFILE, 'rb').readlines():
|
|
|
|
for line in open(self.SHADOWFILE, 'rb').readlines():
|
|
|
@ -1382,7 +1383,7 @@ class SunOS(User):
|
|
|
|
except Exception, err:
|
|
|
|
except Exception, err:
|
|
|
|
self.module.fail_json(msg="failed to update users password: %s" % str(err))
|
|
|
|
self.module.fail_json(msg="failed to update users password: %s" % str(err))
|
|
|
|
|
|
|
|
|
|
|
|
return (rc, out, err)
|
|
|
|
return (rc, out, err)
|
|
|
|
|
|
|
|
|
|
|
|
# ===========================================
|
|
|
|
# ===========================================
|
|
|
|
class DarwinUser(User):
|
|
|
|
class DarwinUser(User):
|
|
|
|