ansible/test
Sam Doran 511d3110f7
Only change expiration date if it is different (#38885) (#39575)
* 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.

(cherry picked from commit 5a6bdef76b)
2018-05-09 10:45:48 -04:00
..
cache Update ansible-test sanity command. (#31958) 2017-10-26 00:21:46 -07:00
integration Only change expiration date if it is different (#38885) (#39575) 2018-05-09 10:45:48 -04:00
legacy exo_dns_record: remove limitation for multiple records only for A type (#35173) 2018-02-05 22:40:02 +01:00
results Collect data from integration test runs. (#28650) 2017-08-25 18:14:47 -04:00
runner Move pyvmomi install into cloud test plugin. 2018-05-08 12:27:37 -07:00
sanity nxos and ios bugfix stable-2.5 (#39845) 2018-05-08 12:38:22 +05:30
units show version brief does not work on iosxr virtual (#39847) 2018-05-08 13:12:23 +05:30
utils Sync stable-2.5 test infrastructure with devel. (#39544) 2018-05-01 15:47:24 -07:00