|
14 | 14 | import kombu.exceptions
|
15 | 15 | from botocore.exceptions import ClientError
|
16 | 16 | from botocore.exceptions import EndpointConnectionError
|
| 17 | +from dbt_copilot_python.utility import is_copilot |
17 | 18 | from django.conf import settings
|
18 | 19 | from django.contrib.auth.mixins import LoginRequiredMixin
|
19 | 20 | from django.contrib.auth.mixins import PermissionRequiredMixin
|
@@ -302,13 +303,20 @@ def check_celery_broker(self) -> Tuple[str, int]:
|
302 | 303 |
|
303 | 304 | def check_s3(self) -> Tuple[str, int]:
|
304 | 305 | try:
|
305 |
| - client = boto3.client( |
306 |
| - "s3", |
307 |
| - aws_access_key_id=settings.HMRC_PACKAGING_S3_ACCESS_KEY_ID, |
308 |
| - aws_secret_access_key=settings.HMRC_PACKAGING_S3_SECRET_ACCESS_KEY, |
309 |
| - endpoint_url=settings.S3_ENDPOINT_URL, |
310 |
| - region_name=settings.HMRC_PACKAGING_S3_REGION_NAME, |
311 |
| - ) |
| 306 | + if is_copilot(): |
| 307 | + client = boto3.client( |
| 308 | + "s3", |
| 309 | + endpoint_url=settings.S3_ENDPOINT_URL, |
| 310 | + region_name=settings.HMRC_PACKAGING_S3_REGION_NAME, |
| 311 | + ) |
| 312 | + else: |
| 313 | + client = boto3.client( |
| 314 | + "s3", |
| 315 | + aws_access_key_id=settings.HMRC_PACKAGING_S3_ACCESS_KEY_ID, |
| 316 | + aws_secret_access_key=settings.HMRC_PACKAGING_S3_SECRET_ACCESS_KEY, |
| 317 | + endpoint_url=settings.S3_ENDPOINT_URL, |
| 318 | + region_name=settings.HMRC_PACKAGING_S3_REGION_NAME, |
| 319 | + ) |
312 | 320 | client.head_bucket(Bucket=settings.HMRC_PACKAGING_STORAGE_BUCKET_NAME)
|
313 | 321 | return "OK", 200
|
314 | 322 | except (ClientError, EndpointConnectionError):
|
|
0 commit comments