Skip to content
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

[DPE-5713] Catch wrong parameters exception on bucket create function call #701

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/backups.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import boto3 as boto3
import botocore
from botocore.exceptions import ClientError
from botocore.exceptions import ClientError, ParamValidationError
from charms.data_platform_libs.v0.s3 import (
CredentialsChangedEvent,
S3Requirer,
Expand Down Expand Up @@ -290,7 +290,7 @@ def _create_bucket_if_not_exists(self) -> None:

bucket.wait_until_exists()
logger.info("Created bucket '%s' in region=%s", bucket_name, region)
except ClientError as error:
except (ClientError, ParamValidationError) as error:
logger.exception(
"Couldn't create bucket named '%s' in region=%s.", bucket_name, region
)
Expand Down Expand Up @@ -783,7 +783,7 @@ def _on_s3_credential_changed_primary(self, event: HookEvent) -> bool:

try:
self._create_bucket_if_not_exists()
except (ClientError, ValueError):
except (ClientError, ValueError, ParamValidationError):
self._s3_initialization_set_failure(FAILED_TO_ACCESS_CREATE_BUCKET_ERROR_MESSAGE)
return False

Expand Down
Loading