tools/checkcerts.py: fix deprecated datetime.datetime.utcnow()#770
Draft
tools/checkcerts.py: fix deprecated datetime.datetime.utcnow()#770
Conversation
The replacement, datetime.datetime.now(datetime.UTC), returns a tz-aware item, so the expiry time must also be timezone-aware. datetime.strptime() does not handle that time format sanely. I don't know why. Luckily zoneinfo exists and can parse likely timezones into valid datetime.tzinfo instances, as far as I can tell. Why isn't this part of datetime? I don't know. But this code seems be somewhat reliable (assuming the timezone name is the last item in the date string, delimited by spaces). Signed-off-by: Dan Mick <[email protected]>
a4a1a7e to
e70f547
Compare
Member
Author
|
replaced original change with a better idea using the new "zoneinfo". It will require Python 3.9, which is not currently on gw, so I'll find a better place to run this. |
Member
Author
|
eh. this is required by and requires a pretty-recent python version (later even than 3.9). In retrospect I think I'll hold off on this until we decide if we even want to continue with checkcerts.py as we update our infra. Adam already has some grafana alerts set up for them and that may be a better plan, particularly if we can change the alerting scheme from the Slack-only verbose format it has now. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.