salt
salt copied to clipboard
[3006.x] Migrate to TZ-aware datetime objects in x509_v2
What does this PR do?
- replaces
datetime.utcnow
withdatetime.now(tz=timezone.utc)
- generally uses TZ-aware datetimes internally
- thus also fixes a bug in CRL creation (see linked issue)
What issues does this PR fix or reference?
Fixes: https://github.com/saltstack/salt/issues/65837 Ref: https://github.com/saltstack/salt/issues/65604
Previous Behavior
CRLs were created with wrong timestamps, Python 3.12 would log DeprecationWarnings
New Behavior
Correct CRL timestamps, no warnings
Merge requirements satisfied?
- [ ] Docs
- [x] Changelog - https://docs.saltproject.io/en/master/topics/development/changelog.html
- [x] Tests written/updated ~~- not sure how to test the issue reliably tbh. A regression is unlikely since we're dealing in TZ-aware datetimes only now.~~
Commits signed with GPG?
Yes
@dwoz can you review this one again please?
Sorry for dismissing the review, had to resolve conflicts after the idna
changes.
@dwoz Anything holding this up? It should be quite straight-forward.