diff --git a/lib/ansible/modules/system/user.py b/lib/ansible/modules/system/user.py index a1bfa3a8943..7d15687c791 100644 --- a/lib/ansible/modules/system/user.py +++ b/lib/ansible/modules/system/user.py @@ -1459,11 +1459,23 @@ class SunOS(User): fields[1] = self.password fields[2] = str(int(time.time() // 86400)) if minweeks: - fields[3] = str(int(minweeks) * 7) + try: + fields[3] = str(int(minweeks) * 7) + except ValueError: + # mirror solaris, which allows for any value in this field, and ignores anything that is not an int. + pass if maxweeks: - fields[4] = str(int(maxweeks) * 7) + try: + fields[4] = str(int(maxweeks) * 7) + except ValueError: + # mirror solaris, which allows for any value in this field, and ignores anything that is not an int. + pass if warnweeks: - fields[5] = str(int(warnweeks) * 7) + try: + fields[5] = str(int(warnweeks) * 7) + except ValueError: + # mirror solaris, which allows for any value in this field, and ignores anything that is not an int. + pass line = ':'.join(fields) lines.append('%s\n' % line) open(self.SHADOWFILE, 'w+').writelines(lines)