719c40bfdf
* [stable-2.10] facts - fix incorrect time for some date_time_facts (#70665)
The iso8601_micro and iso8601 facts incorrectly called now.utcnow(), resulting
in a new timestamp at the time it was called, not a conversion of the previously
stored timestamp.
Correct this by capturing the UTC timestamp once then calculating the local
time using the UTC offset of the current system.
* Use time.time() for getting the current time
* Convert from that stored epoch timestamp to local and UTC times
* Used existing timestamp for epoch time
* Add unit tests that validate the formate of the return value rather than an exact value since mocking time and timezone is non-trivial
(cherry picked from commit
|
||
---|---|---|
.. | ||
_vendor | ||
ansible_test | ||
cli | ||
compat | ||
config | ||
errors | ||
executor | ||
galaxy | ||
inventory | ||
inventory_test_data/group_vars | ||
mock | ||
module_utils | ||
modules | ||
parsing | ||
playbook | ||
plugins | ||
regex | ||
template | ||
utils | ||
vars | ||
__init__.py | ||
requirements.txt | ||
test_constants.py | ||
test_context.py |