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

LocationConstraint is maybe AWS specific? Doesn't work with OpenStack RadosGW #689

Open
hloeung opened this issue Dec 4, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@hloeung
Copy link

hloeung commented Dec 4, 2024

Steps to reproduce

  1. deploy units to a Juju model using the OpenStack provider
  2. deploy the s3-integrator charm setting region to prodstack6 (or whatever you have your cloud configured with)

Expected behavior

Bucket or container created for backups.

Actual behavior

2024-12-04 02:53:25 DEBUG unit.postgresql/0.juju-log server.go:325 s3-parameters:26: Calling s3:create_bucket with {'Bucket': 'is-managed-database-prod-marketing-airbyte-marketo', 'CreateBucketConfiguration': {'LocationConstraint': 'prodstack6'}}
2024-12-04 02:53:25 DEBUG unit.postgresql/0.juju-log server.go:325 s3-parameters:26: Making request for OperationModel(name=CreateBucket) with params: {'url_path': '', 'query_string': {}, 'method': 'PUT', 'headers': {'User-Agent': 'Boto3/1.35.8 md/Botocore#1.35.8 ua/2.0 os/linux#5.15.0-122-generic md/arch#x86_64 lang/python#3.10.12 md/pyimpl#CPython cfg/retry-mode#legacy Botocore/1.35.8 Resource'}, 'body': b'<CreateBucketConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"><LocationConstraint>prodstack6</LocationConstraint></CreateBucketConfiguration>', 'auth_path': '/is-managed-database-prod-marketing-airbyte-marketo/', 'url': 'https://radosgw.ps6.canonical.com/is-managed-database-prod-marketing-airbyte-marketo', 'context': {'client_region': 'prodstack6', 'client_config': <botocore.config.Config object at 0x7fec0be71e10>, 'has_streaming_input': False, 'auth_type': 'v4', 'unsigned_payload': None, 's3_redirect': {'redirected': False, 'bucket': 'is-managed-database-prod-marketing-airbyte-marketo', 'params': {'Bucket': 'is-managed-database-prod-marketing-airbyte-marketo', 'CreateBucketConfiguration': {'LocationConstraint': 'prodstack6'}}}, 'input_params': {'Bucket': 'is-managed-database-prod-marketing-airbyte-marketo'}, 'signing': {'region': 'prodstack6', 'signing_name': 's3', 'disableDoubleEncoding': True}, 'endpoint_properties': {'authSchemes': [{'disableDoubleEncoding': True, 'name': 'sigv4', 'signingName': 's3', 'signingRegion': 'prodstack6'}]}}}
b'<?xml version="1.0" encoding="UTF-8"?><Error><Code>InvalidLocationConstraint</Code><Message>The specified location-constraint is not valid</Message><BucketName>is-managed-database-prod-marketing-airbyte-marketo</BucketName><RequestId>tx00000ec9a1307bc4a1b7e-00674fc425-5afce5e-default</RequestId><HostId>5afce5e-default-default</HostId></Error>'
    bucket.create(CreateBucketConfiguration={"LocationConstraint": region})
botocore.exceptions.ClientError: An error occurred (InvalidLocationConstraint) when calling the CreateBucket operation: The specified location-constraint is not valid

Versions

Operating system: [email protected]

Juju CLI: 3.5.3

Juju agent: 3.5.3

Charm revision: postgresql 14.12 active 3 postgresql 14/stable 468 yes

Log output

Juju debug log:

Additional context

Perhaps it can detect from the provided endpoint if it starts with radosgw or something not AWS specific and call createbucket without LocationConstraint?

        if not exists:
            try:
                bucket.create(CreateBucketConfiguration={"LocationConstraint": region})

                bucket.wait_until_exists()
                logger.info("Created bucket '%s' in region=%s", bucket_name, region)
            except ClientError as error:
                logger.exception(
                    "Couldn't create bucket named '%s' in region=%s.", bucket_name, region
                )
@hloeung hloeung added the bug Something isn't working label Dec 4, 2024
Copy link

Thank you for reporting us your feedback!

The internal ticket has been created: https://warthogs.atlassian.net/browse/DPE-6143.

This message was autogenerated

@hloeung
Copy link
Author

hloeung commented Dec 4, 2024

Changing it to bucket.create() worked for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant