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

handle us-east-1 when creating bucket #180

Closed
wants to merge 1 commit into from
Closed

handle us-east-1 when creating bucket #180

wants to merge 1 commit into from

Conversation

ibarria0
Copy link
Contributor

@ibarria0 ibarria0 commented Aug 6, 2015

No description provided.

@ibarria0 ibarria0 changed the title handle us-east-1 when creating bucket #closes 179 handle us-east-1 when creating bucket Aug 6, 2015
@ibarria0
Copy link
Contributor Author

ibarria0 commented Aug 6, 2015

Boto will give an error when tryng to create a bucket on region us-east-1 because this issue boto/boto3#125

It seems that you need to use an empty string instead of the actual "us-east-1" to specify that location.

Im proposing to do this:

    def create_bucket(self):
        """
        :returns: The newly created bucket
        """
        # S3 does not accept "us-east-1" must use "" instead
        location = self._get_bucket_region()
        if location == "us-east-1":
            location = ""
        try:
            bucket = self.get_connection().create_bucket(self.bucket_name,
                policy='public-read', location=location
            )
        except S3CreateError:
            logger.info(
                'Bucket with name %s already is used by someone else, '
                'please try again with another name', self.bucket_name)
            return  #TODO: These should be exceptions

        # Configure S3 to use the index.html and error.html files for indexes and 404/500s.
        bucket.configure_website(self._index_page, self._error_page)

        return bucket

All test pass

@krallin
Copy link
Collaborator

krallin commented Sep 6, 2015

Looks like this was fixed here: 55e49bb

Sorry about not getting to your PR earlier — I think you and @koenbok might have run into the same issue separately.

Cheers

@krallin krallin closed this Sep 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants