AAP-54894 Bug fix to ensure facts are gathered when nodes are set to different timezones#16125
AAP-54894 Bug fix to ensure facts are gathered when nodes are set to different timezones#16125djyasin wants to merge 7 commits intoansible:develfrom
Conversation
|
|
||
| # Get the timestamp that was saved during start_fact_cache() | ||
| # This is the mtime of the last fact file written, NOT the summary file's mtime | ||
| facts_write_time = summary.get('last_write_time') |
There was a problem hiding this comment.
I remember this. I remember thinking that doing this would be more durable / correct. I don't know of what particular bug it would fix, but I support this change.
There was a problem hiding this comment.
Actually, I partially take this back. The best way to do this would be to compare a per-host file against a file written by ansible-runner on the execution node. Ideally, we can even keep 2 reference files:
- a reference file written by the control node
- a reference file written by the execution node
This isn't overkill, because these can be empty files, and the handling of time zones is bananas.
Obviously, for comparison purposes, we want to compare the per-host facts file against the reference from the execution node. It is very important that it is written at the start of the run.
Why should we keep a reference file written by the control node? Well, that comes chronologically before the job start on the execution node. So if its modtime was greater than the execution node, then clearly you've identified a problem. This also should correspond to the modtime of the unmodified files. If we really can't get anything else straight, we can backdate all the reference per-host files to the reference file, and have our criteria be that the per-host file is anything different from the reference file. Then the execution node reference file would become the sanity check. If the per-host file is not equal to the control node reference file modtime, and also before the execution node reference file modtime, then something has gone wrong, and at least we can identify that.
AlanCoding
left a comment
There was a problem hiding this comment.
This bakes in too many assumptions about how other systems work, and I think we should proceed more carefully and systematically, looking into a fix involving ansible-runner
|
Closing this in favor of an Ansible-runner fix |
Codecov Report✅ All modified and coverable lines are covered by tests. 🚀 New features to boost your workflow:
|
…different timezones
…y instead of file mtime
…t_cache_modified.json
e6b51ff to
fb5015e
Compare
SUMMARY
Add unit test and revise facts.py to handle cases of nodes being set to different timezones
ISSUE TYPE
COMPONENT NAME
ADDITIONAL INFORMATION
Note
Finish fact caching now prefers ansible-runner’s modified files list and falls back to a stored baseline timestamp, with comprehensive tests covering timezone and fallback scenarios.
finish_fact_cache: Preferfact_cache_modified.jsonto detect changed host fact files; fallback tosummary['last_write_time']for timestamp comparison.awx/main/tests/unit/models/test_host_facts_timezone.pywith cases for timezone mismatches, clock skew, baseline timestamp fallback, and runnermodified_fileshandling.Written by Cursor Bugbot for commit 3884b99. This will update automatically on new commits. Configure here.