Module 'ceph_add_users_buckets.py' didn't catch the right exception
- Dominant language
- Python
- Stars
- 10
- Forks
- 17
- PR merge metrics
- No merged PRs in 30d
Description
Hi ,
I figured out a little typo in the module 'ceph_add_users_buckets.py' when you create a bucket , it doesn't catch the right exception 'radosgw.exception.NoSuchBucket' it only catch the 'TypeError' Exception which cause the module to fail if we try to create a new bucket with the error 'radosgw.exception.NoSuchBucket: NoSuchBucket (404 Not Found)' .
Here below the simple fix suggested on the file ' ceph_add_users_buckets.py ' (just catch the NoSuchBucket Exception)==>
```
def create_buckets(rgw, buckets, result):
...
for bucket_info in buckets:
bucket = bucket_info['bucket']
user = bucket_info['user']
# check if bucket exists
try:
bucket_info = rgw.get_bucket(bucket_name=bucket)
except TypeError:
# it doesnt exist
bucket_info = None
** except radosgw.exception.NoSuchBucket:
bucket_info = None **
# if it exists add to failed list
if bucket_info:
failed_buckets.append(bucket)
```
Contributor guide
Research direction
Open ceph_add_users_buckets.py and start at create_buckets, especially the rgw.get_bucket call and its exception handling. Confirm the bucket-creation path treats radosgw.exception.NoSuchBucket as a missing bucket, then verify that creating a new bucket no longer fails with the reported 404 error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- devops
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100