Skip to content
This repository has been archived by the owner on Sep 23, 2020. It is now read-only.

S3Connection.get_bucket throws a 400 error on boto 2.32 #125

Open
rberrelleza opened this issue Dec 3, 2014 · 1 comment
Open

S3Connection.get_bucket throws a 400 error on boto 2.32 #125

rberrelleza opened this issue Dec 3, 2014 · 1 comment

Comments

@rberrelleza
Copy link

The same issue doesn't repro on boto 2.2.2 and older, it starting appearing on boto 2.32. You can validate by running the rollowing snippet:

import boto
from boto.s3.connection import S3Connection
from boto.s3.connection import OrdinaryCallingFormat
from boto.s3.key import Key

bucket="test"
access_key="ACCESS_KEY"
secret_key="SECRET_KEY"
host="localhost"
port=4288

s3conn = S3Connection(access_key,secret_key, is_secure=False,port=port,host=host, calling_format=OrdinaryCallingFormat())
s3conn.create_bucket(bucket)

# Throws
b = s3conn.get_bucket(bucket)
print(b)

The nimbus log for the issue is:

2014-12-03 07:46:59,616 - 18017 - INFO - Access granted to ID=u87xc9prmanQD8DlvkPWn requestId=8fff49c47ac011e4a339005056b5d1fb uri=/test/
2014-12-03 07:46:59,616 - 18017 - INFO - path /test/
2014-12-03 07:46:59,616 - 18017 - INFO - path /test/ bucket files object None
2014-12-03 07:46:59,623 - 18017 - ERROR - <?xml version="1.0" ?><Error><Code>InvalidArgument</Code><Message>Invalid Argument</Message><Resource>/test/</Resource><RequestId>8fff49c47ac011e4a339005056b5d1fb</RequestId></Error>
2014-12-03 07:46:59,623 - 18017 - ERROR - Stack trace
2014-12-03 07:46:59,624 - 18017 - ERROR - ===========
2014-12-03 07:46:59,624 - 18017 - ERROR - Traceback (most recent call last):
  File "/opt/cumulus/lib/python2.7/site-packages/pycb-0.1-py2.7.egg/pycb/cumulus.py", line 172, in process_event
    self.allowed_event(request, user, requestId, rPath)
  File "/opt/cumulus/lib/python2.7/site-packages/pycb-0.1-py2.7.egg/pycb/cumulus.py", line 184, in allowed_event
    cbR = self.request_object_factory(request, user, path, requestId)
  File "/opt/cumulus/lib/python2.7/site-packages/pycb-0.1-py2.7.egg/pycb/cumulus.py", line 156, in request_object_factory
    raise cbException('InvalidArgument')
cbException: Invalid Argument

2014-12-03 07:46:59,624 - 18017 - ERROR - ===========
2014-12-03 07:46:59,624 - 18017 - ERROR - <class 'pycb.cbException.cbException'>
@rberrelleza rberrelleza changed the title S3Connection.get_bucket fails to retrieve bucket on boto 2.32 S3Connection.get_bucket throws a 400 error on boto 2.32 Dec 3, 2014
@rberrelleza
Copy link
Author

I did some more research, and this is due to a change in the behavior in boto. In boto 2.2.2, a call to S3Connection.get_bucket(BUCKET_NAME) results in a GET request ( <GET /files/?&max-keys=0 HTTP/1.1>), but in boto 2.32 the same call is now a HEAD request to <HEAD /files/ HTTP/1.1>. This breaks cumulus.request_object_factory, which doesn't have an option to handle a HEAD on the bucket directly, without an object name.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant