community.general/lib/ansible/modules/system
Sam Doran 5a6bdef76b Only change expiration date if it is different (#38885)
* Only change expiration date if it is different

Modify user_info() method to also return the password expiration.
Compare current and desired expiration times and only change if they are different.

* Improve formatting on user tests

* Add integration test for expiration

* Add changelog fragment

* Improve integration test

Skip macOS and use getent module for validating expiration date.

* Fix expiration change for FreeBSD

* Don't use datetime since the total_seconds method isn't available on CentOS 6

* Use better name for expiration index field

Use separate tasks for verifying expiration date on BSD

* Use calendar.timegm() rather than time.mktime()

calendar.timegm() is the inverse of time.gmtime() and returns a timestamp in UTC not localtime
Add tests that change the system timezone away from UTC

* Mark tests as destructive and use test for change status

* Fix account expiration for FreeBSD

Use DATE_FORMAT when setting expiration date on FreeBSD. Previously the argument passed to -e was an integer of days since epoch when the account will expire which was inserted directly into master.passwd. This value is interpreted as seconds since epoch by the system, meaning the account expiration was actually set to a few hours past epoch.

Greatly simply comparing desired  and current expiration time by using the first three values of the struct_time tuple rather than doing a whole bunch of manipulations of the seconds since epoch.
2018-05-01 11:19:01 -04:00
..
__init__.py package files 2016-12-08 11:22:22 -05:00
aix_inittab.py Ansible system module: sanity pep8 fixes (#32314) 2017-11-07 13:46:55 +01:00
aix_lvol.py Fix invalid string escape sequences. 2017-11-21 20:59:08 -08:00
alternatives.py Alternatives module: Add a check that the path to the executable exist (#24800) 2017-08-18 15:31:06 -04:00
at.py at: PEP8 compliancy and doc fixes (#30881) 2017-10-30 00:56:54 +01:00
authorized_key.py Address some language in EXAMPLES (#37555) 2018-03-19 13:51:23 -04:00
awall.py Clean up module documentation (#36909) 2018-03-15 22:15:24 +01:00
beadm.py More validate module fixes (#39097) 2018-04-24 18:05:50 +01:00
capabilities.py Ansible system module: sanity pep8 fixes (#32314) 2017-11-07 13:46:55 +01:00
cron.py name cron 2018-04-16 19:02:14 -04:00
cronvar.py Ansible system module: sanity pep8 fixes (#32314) 2017-11-07 13:46:55 +01:00
crypttab.py Ansible system module: sanity pep8 fixes (#32314) 2017-11-07 13:46:55 +01:00
dconf.py Update metadata to 1.1 2017-08-15 23:12:08 -07:00
debconf.py Update debconf example (#33397) 2017-11-30 18:07:11 +10:00
facter.py PEP8 fixes: Ansible system module and playbook base.py (#32322) 2017-11-07 09:38:59 +01:00
filesystem.py filesystem: fix documentation (#36556) 2018-02-23 10:59:38 +00:00
firewalld.py refactor firewalld module, add firewalld module_util (#37603) 2018-04-30 15:33:28 -05:00
gconftool2.py PEP8 fixes: Ansible system module and playbook base.py (#32322) 2017-11-07 09:38:59 +01:00
getent.py getent: PEP8 compliancy and doc fixes (#30885) 2017-10-30 00:58:04 +01:00
gluster_volume.py Module DOCUMENTATION should match argspec (#34895) 2018-01-16 12:18:51 +00:00
group.py added 'local' option to group (#34805) 2018-02-09 01:02:35 -05:00
hostname.py Replace LooseVersion comparison with int/float comparison. Fixes #35435 (#35519) 2018-01-30 15:27:22 -06:00
interfaces_file.py Fix for changing method only on specified interface (#39015) 2018-04-27 05:18:19 -04:00
iptables.py Allow inversion of uid_owner match in iptables module (#36073) 2018-03-01 12:24:02 +00:00
java_cert.py PEP8 fixes: Ansible system module and playbook base.py (#32322) 2017-11-07 09:38:59 +01:00
kernel_blacklist.py Fix invalid string escape sequences. 2017-11-21 20:59:08 -08:00
known_hosts.py Clean up module documentation (#36909) 2018-03-15 22:15:24 +01:00
locale_gen.py Remove deprecated get_exception API 2018-02-05 23:39:56 -05:00
lvg.py lvg: don't fail if an unknown physical device is encountered (#38446) 2018-04-08 05:04:28 -04:00
lvol.py Fix task description of thinpool examples (#35402) 2018-01-26 18:36:10 +00:00
make.py Clean up module documentation (#36909) 2018-03-15 22:15:24 +01:00
mksysb.py More validate module fixes (#39097) 2018-04-24 18:05:50 +01:00
modprobe.py modprobe: PEP8 compliancy and doc fixes (#31255) 2017-10-08 09:21:58 -04:00
mount.py More validate module fixes (#39097) 2018-04-24 18:05:50 +01:00
nosh.py More validate module fixes (#39097) 2018-04-24 18:05:50 +01:00
ohai.py Fix the docs link to Ohai in the Ohai module (#33788) 2018-03-08 17:00:17 -08:00
open_iscsi.py More validate module fixes (#39097) 2018-04-24 18:05:50 +01:00
openwrt_init.py Clean up module documentation (#36909) 2018-03-15 22:15:24 +01:00
osx_defaults.py Clean up module documentation (#36909) 2018-03-15 22:15:24 +01:00
pam_limits.py More validate module fixes (#39097) 2018-04-24 18:05:50 +01:00
pamd.py Remove deprecated get_exception API 2018-02-05 23:39:56 -05:00
parted.py [parted] Fixes incorrect arg spec and check (#27839) 2017-08-29 22:18:22 +02:00
ping.py Clarify which ping module to use (#34935) 2018-01-17 14:02:06 +00:00
puppet.py fixes bug: puppet module is no longer updating persistent external facts (#38026) 2018-03-29 14:54:44 +10:00
runit.py Fixed spelling error in runit module (#35948) 2018-02-10 21:13:55 +05:30
seboolean.py PEP8 fixes: Ansible system module and playbook base.py (#32322) 2017-11-07 09:38:59 +01:00
sefcontext.py Add note about sefcontext doing no restorecon (#39076) 2018-04-25 18:05:03 +02:00
selinux.py Clean up module documentation (#36909) 2018-03-15 22:15:24 +01:00
selinux_permissive.py Clean up module documentation (#36909) 2018-03-15 22:15:24 +01:00
seport.py Accept list or string for ports is seport module (#36661) 2018-03-13 12:04:27 -04:00
service.py chkconfig localizes messages, ansible fails to recognise 2018-04-23 17:44:36 -04:00
service_facts.py service_facts module (#34065) 2018-01-08 13:35:16 -08:00
setup.py Add fact to obtain iSCSI initiator IQN 2018-03-13 17:39:53 -07:00
solaris_zone.py PEP8 fixes: Ansible system module and playbook base.py (#32322) 2017-11-07 09:38:59 +01:00
svc.py Fix invalid string escape sequences. 2017-11-21 20:59:08 -08:00
sysctl.py Clean up module documentation (#36909) 2018-03-15 22:15:24 +01:00
systemd.py Fix bool notation in systemd (#39064) 2018-04-20 06:44:48 -04:00
timezone.py Fix typo in timezone.py (#37442) 2018-03-16 11:18:03 +05:30
ufw.py PEP8 fixes: Ansible system module and playbook base.py (#32322) 2017-11-07 09:38:59 +01:00
user.py Only change expiration date if it is different (#38885) 2018-05-01 11:19:01 -04:00
vdo.py Allow block map cache size modification. (#35667) 2018-04-24 16:14:04 -04:00