[PR #1538/94bb14c2 backport][stable-6] s3_bucket: fix VersionId==null when s3 object not versioned #1545
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.
This is a backport of PR #1538 as merged into main (94bb14c).
SUMMARY
Boto3 1.26.129 (possibly earlier) returns "VersionId": "null" from s3_client.list_object_versions() when s3 objects are not versioned. Previously, "VersionId" was None when an s3 object was not versioned. This change broke s3_bucket.destroy_bucket() because the the VersionId was no longer popped (line 1166) when the s3 object was not versioned, and the subsequent attempts to delete the s3 object failed as the "VersionId" was absolutely not "null". Adding in `or fk.get("VersionId")=="null" will catch this new value for non-versioned s3 objects while allowing backwards compatibility with previous versions that return None for "VersionId".
Fixes #1533 s3_bucket.destroy_bucket fails to delete unversioned items
ISSUE TYPE
COMPONENT NAME
s3_bucket.py
ADDITIONAL INFORMATION
s3_bucket:
name: "my_bucket_with_objects_with_no_versioning"
state: absent
force: yes