summaryrefslogtreecommitdiff
path: root/lib/ansible/modules/system/user.py
diff options
context:
space:
mode:
authorMatt Clay <matt@mystile.com>2019-02-18 06:59:13 -0800
committerSam Doran <sdoran@redhat.com>2019-02-18 09:59:13 -0500
commit687279c7bdc027d7ddcb75e106837a96b63525c4 (patch)
treee5ac900378fafe2f7b68812e0749922facf8111c /lib/ansible/modules/system/user.py
parentf6ba9be141a0f37fc9dd6e2f15763747d76dca52 (diff)
downloadansible-687279c7bdc027d7ddcb75e106837a96b63525c4.tar.gz
Set user expires on FreeBSD using UTC. (#52276)
Diffstat (limited to 'lib/ansible/modules/system/user.py')
-rw-r--r--lib/ansible/modules/system/user.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/ansible/modules/system/user.py b/lib/ansible/modules/system/user.py
index eb54b80374..753a8e67a0 100644
--- a/lib/ansible/modules/system/user.py
+++ b/lib/ansible/modules/system/user.py
@@ -404,6 +404,7 @@ uid:
import errno
import grp
+import calendar
import os
import re
import pty
@@ -1150,7 +1151,7 @@ class FreeBsdUser(User):
if self.expires < time.gmtime(0):
cmd.append('0')
else:
- cmd.append(time.strftime(self.DATE_FORMAT, self.expires))
+ cmd.append(str(calendar.timegm(self.expires)))
# system cannot be handled currently - should we error if its requested?
# create the user
@@ -1268,7 +1269,7 @@ class FreeBsdUser(User):
# Current expires is negative or we compare year, month, and day only
if current_expires <= 0 or current_expire_date[:3] != self.expires[:3]:
cmd.append('-e')
- cmd.append(time.strftime(self.DATE_FORMAT, self.expires))
+ cmd.append(str(calendar.timegm(self.expires)))
# modify the user if cmd will do anything
if cmd_len != len(cmd):