Comment 1 for bug 945937

Revision history for this message
Chmouel Boudjnah (chmouel) wrote : Re: swift3: InvalidBucketName should come back with 404 not 400

FYI: I am using this code :

        except S3ResponseError, s3error:
            s3error_string = '%s' % s3error
            if s3error_string.find('404') >= 0:
                try:
                    print 'Creating bucket:', self.bucket
                    bucket_instance = s3conn.create_bucket(self.bucket,
                                                           policy=acl,
                                                           location=location)
                except S3CreateError:
                    msg = 'Unable to create bucket %s' % self.bucket
                    self.display_error_and_exit(msg)
            elif s3error_string.find('403') >= 0:
                msg = 'You do not have permission to access bucket:', self.bucket
                self.display_error_and_exit(msg)

from euca2ools/commands/euca/uploadbundle.py , I don't have an AMAZON s3 account so can't test directly with whatever they implemented.