cn
cn copied to clipboard
Buckets created with boto cannot be listed
example.py
#!/usr/bin/env python
access_key = 'xxx' # Add your S3 Access Key here
secret_key = 'xxx' # Add your S3 Secret Key here
bucket_name = "foobar"
ceph_host = '192.168.7.27' # Add your rgw0 Ceph host here
ceph_port = 8000
import boto
import boto.s3.connection
conn = boto.connect_s3(
aws_access_key_id = access_key,
aws_secret_access_key = secret_key,
host = ceph_host,
port = ceph_port,
is_secure=False,
calling_format = boto.s3.connection.OrdinaryCallingFormat()
)
bucket = conn.create_bucket("broken")
print "Bucket {} created!".format("broken")
from boto.s3.key import Key
object_key = "spark-test"
object_value = "./foo"
bucket = conn.get_bucket("broken")
k = Key(bucket)
k.key = object_key
k.set_contents_from_filename(object_value)
print "Object {} added in bucket {}!".format(object_key, "broken")
This doesn't work -
kyle@kyle-mini ~ $ > ./cn s3 ls my-first-cluster s3://broken
ERROR: S3 error: 403 (SignatureDoesNotMatch)
This does work -
kyle@kyle-mini ~ $ > ./cn s3 la my-first-cluster
2018-06-21 15:52 4 s3://broken/spark-test
Using the Sree web interface, I get a "Failed to list objects: Network Failure" error for this bucket.
You can "fix" this by enabling CORS on the bucket created with boto. Perhaps when you use the web interface it does this automatically when it creates the bucket. Is this expected?