-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
S3: fix exception from ObjectLock retention #12165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -2011,7 +2012,7 @@ def restore_object( | |||
return RestoreObjectOutput() | |||
|
|||
restore_expiration_date = add_expiration_days_to_datetime( | |||
datetime.datetime.utcnow(), restore_days | |||
datetime.datetime.now(datetime.UTC), restore_days |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
datetime.datetime.utcnow()
is now deprecated and should be replaced by datetime.datetime.now(datetime.UTC)
LocalStack Community integration with Pro 2 files ± 0 2 suites ±0 59m 47s ⏱️ - 53m 33s Results for commit 345737d. ± Comparison against base commit ed8c76e. This pull request removes 2333 and adds 2 tests. Note that renamed tests count towards both.
♻️ This comment has been updated with latest results. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice 👍
tests/aws/services/s3/test_s3.py
Outdated
@@ -9409,10 +9377,20 @@ def test_s3_object_retention_exc(self, aws_client, s3_create_bucket, snapshot): | |||
Bucket=s3_bucket_locked, | |||
Key=object_key, | |||
VersionId=version_id, | |||
Retention={"Mode": "GOVERNANCE", "RetainUntilDate": datetime.datetime(2025, 1, 1)}, | |||
Retention={"Mode": "GOVERNANCE", "RetainUntilDate": datetime.datetime(2029, 1, 1)}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: did you consider using a variable datetime based on the current date, like now() + 1 year?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually did not, and this is a much better long term solution 🙃 thanks, will update!
yes, indeed, interesting decision from their side |
Motivation
Follow up from regenerating snapshots in #12145, one date that was set in the future actually was now in the past 😅 and triggered a new kind of exception. It had been skipped. This PR now implements this exception.
Also removed a few now useless snapshot markers that have been fixed in the meantime but not removed.
Note: weird thing but S3 returns the error in the PST timezone, interesting 🤔
Changes