Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

AAP-54894 Bug fix to ensure facts are gathered when nodes are set to different timezones#16125

Open
djyasin wants to merge 7 commits intoansible:develfrom
djyasin:devel_bug_fix_AAP-54894
Open

AAP-54894 Bug fix to ensure facts are gathered when nodes are set to different timezones#16125
djyasin wants to merge 7 commits intoansible:develfrom
djyasin:devel_bug_fix_AAP-54894

Conversation

@djyasin
Copy link
Member

@djyasin djyasin commented Oct 8, 2025

SUMMARY

Add unit test and revise facts.py to handle cases of nodes being set to different timezones

ISSUE TYPE
  • Bug, Docs Fix or other nominal change
COMPONENT NAME
  • API
ADDITIONAL INFORMATION
awx: 4.6.20

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.

  • Backend (facts processing):
    • finish_fact_cache: Prefer fact_cache_modified.json to detect changed host fact files; fallback to summary['last_write_time'] for timestamp comparison.
    • Adjust logic to only read/update facts when flagged as modified; count unchanged files accordingly.
  • Tests:
    • Add awx/main/tests/unit/models/test_host_facts_timezone.py with cases for timezone mismatches, clock skew, baseline timestamp fallback, and runner modified_files handling.

Written by Cursor Bugbot for commit 3884b99. This will update automatically on new commits. Configure here.

cursor[bot]

This comment was marked as outdated.

@djyasin djyasin requested a review from fosterseth October 10, 2025 17:47

# 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')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Member

@AlanCoding AlanCoding left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@djyasin
Copy link
Member Author

djyasin commented Oct 14, 2025

Closing this in favor of an Ansible-runner fix

@djyasin djyasin closed this Oct 14, 2025
@djyasin djyasin reopened this Oct 14, 2025
@codecov
Copy link

codecov bot commented Oct 14, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.22%. Comparing base (72a42f2) to head (e6b51ff).

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@djyasin djyasin force-pushed the devel_bug_fix_AAP-54894 branch from e6b51ff to fb5015e Compare October 15, 2025 13:26
cursor[bot]

This comment was marked as outdated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants