Skip to content

Commit

Permalink
Merge pull request #9096 from vavuthu/fix_bucket_versioning
Browse files Browse the repository at this point in the history
catch botocore exception for fetching bucket versioning
  • Loading branch information
vavuthu authored Jan 1, 2024
2 parents a071ec2 + 85c1811 commit cc1f7b0
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions ocs_ci/ocs/resources/objectbucket.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import tempfile

import boto3
import botocore

from ocs_ci.framework import config
from ocs_ci.helpers.helpers import (
Expand Down Expand Up @@ -429,8 +430,12 @@ def internal_delete(self):
else:
self.s3resource.Bucket(self.name).objects.all().delete()
self.s3resource.Bucket(self.name).delete()
except boto3.errorfactory.NoSuchKey as e:
raise NotFoundError(e)
except botocore.exceptions.ClientError as e:
if e.response["Error"]["Code"] == "NoSuchBucket":
logger.info(f"Bucket {self.name} doesn't exist")
raise NotFoundError(e)
else:
raise e

@property
def internal_status(self):
Expand Down

0 comments on commit cc1f7b0

Please sign in to comment.