Skip to content

Commit

Permalink
Fix for s3 delete_object invalid/empty version string (#3787)
Browse files Browse the repository at this point in the history
Signed-off-by: Parikshith <[email protected]>
  • Loading branch information
parikshithb authored Feb 8, 2021
1 parent a661256 commit 1110a18
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions ocs_ci/ocs/bucket_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,7 @@ def s3_get_object(s3_obj, bucketname, object_key, versionid=""):
)


def s3_delete_object(s3_obj, bucketname, object_key, versionid=""):
def s3_delete_object(s3_obj, bucketname, object_key, versionid=None):
"""
Simple Boto3 client based Delete object
Expand All @@ -795,9 +795,12 @@ def s3_delete_object(s3_obj, bucketname, object_key, versionid=""):
dict : Delete object response
"""
return s3_obj.s3_client.delete_object(
Bucket=bucketname, Key=object_key, VersionId=versionid
)
if versionid:
return s3_obj.s3_client.delete_object(
Bucket=bucketname, Key=object_key, VersionId=versionid
)
else:
return s3_obj.s3_client.delete_object(Bucket=bucketname, Key=object_key)


def s3_put_bucket_website(s3_obj, bucketname, website_config):
Expand Down

0 comments on commit 1110a18

Please sign in to comment.