Bug 1343813
| Summary: | Cannot enable rgw AWSv4 with boto without workaround | ||
|---|---|---|---|
| Product: | [Red Hat Storage] Red Hat Ceph Storage | Reporter: | shilpa <smanjara> |
| Component: | Documentation | Assignee: | John Wilkins <jowilkin> |
| Status: | CLOSED CURRENTRELEASE | QA Contact: | ceph-qe-bugs <ceph-qe-bugs> |
| Severity: | unspecified | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 2.0 | CC: | ceph-eng-bugs, gmeno, hklein, hnallurv, jowilkin, kdreyer, mbenjamin, mlawrenc, owasserm, parveenks.ofc, robbat2, sweil |
| Target Milestone: | rc | Keywords: | Reopened |
| Target Release: | 2.0 | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | If docs needed, set a value | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2016-09-30 17:22:32 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
Shilpa, $ sudo rpm -qa | grep rados librados2-10.2.1-0.el7.x86_64 libradosstriper1-10.2.1-0.el7.x86_64 python-rados-10.2.1-0.el7.x86_64 ceph-radosgw-10.2.1-0.el7.x86_64 $ $ python Python 2.7.10 (default, Oct 23 2015, 19:19:21) [GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import sys, boto >>> boto.Version '2.40.0' >>> W.r.t : "As a workaround, I am setting region_name in boto to empty string to get it working." I tried placing empty string in my boto config file foo$ cat ~/.boto [Credentials] aws_access_key_id = XXXXXXXXXXXX aws_secret_access_key = YYYYYYYYYYY [s3] use-sigv4 = True region_name = "" foo$ [Boto] region_name = "" But still getting the same error. Please help me with the working workaround. - Parveen Correct workaround:
vi test.py
access_key = $access
secret_key = $secret
boto.config.add_section('s3')
boto.config.set('s3', 'use-sigv4', 'True')
conn = boto.connect_s3(
aws_access_key_id = access_key,
aws_secret_access_key = secret_key,
host = 's3.<zone>.hostname',
port = 8080,
is_secure=False,
calling_format = boto.s3.connection.OrdinaryCallingFormat(),
)
Ensure that 's3.<zone>.hostname' is resolved.
Can we have the workaround in c#8 documented in the RGW doc section 2.9.3 "Test S3 access". A note would be sufficient. Thanks. Looks good to me. Here's a MUCH better fix, that doesn't depend on the boto code to parse the region name out of the hostname:
access_key = $access
secret_key = $secret
botoconfig.add_section('s3')
botoconfig.set('s3', 'use-sigv4', 'True')
conn = boto.connect_s3(
aws_access_key_id = access_key,
aws_secret_access_key = secret_key,
host = host,
port = 8080,
is_secure=False,
calling_format = boto.s3.connection.OrdinaryCallingFormat(),
)
conn.auth_region_name = 'us-west-1' # Or any value you need here.
(In reply to Robin H. Johnson from comment #15) > Here's a MUCH better fix, that doesn't depend on the boto code to parse the > region name out of the hostname: > > access_key = $access > secret_key = $secret > botoconfig.add_section('s3') > botoconfig.set('s3', 'use-sigv4', 'True') > conn = boto.connect_s3( > aws_access_key_id = access_key, > aws_secret_access_key = secret_key, > host = host, > port = 8080, > is_secure=False, > calling_format = boto.s3.connection.OrdinaryCallingFormat(), > ) > conn.auth_region_name = 'us-west-1' # Or any value you need here. This is an upstream boto fix, yes? thanks, Matt It's a fix for any Boto2 consumers. (In reply to Robin H. Johnson from comment #17) > It's a fix for any Boto2 consumers. Oh, I see. Thanks, Matt |
Description of problem: With boto v2, awsv4 fails because it expects a region_name field. Version-Release number of selected component (if applicable): ceph-radosgw-10.2.1-7.el7cp.x86_64 python-boto-2.34.0-5.el7.noarch How reproducible: Always Steps to Reproduce: 1. vi test.py access_key = $access secret_key = $secret botoconfig.add_section('s3') botoconfig.set('s3', 'use-sigv4', 'True') conn = boto.connect_s3( aws_access_key_id = access_key, aws_secret_access_key = secret_key, host = host, port = 8080, is_secure=False, calling_format = boto.s3.connection.OrdinaryCallingFormat(), ) 2. python ~/test.py Traceback (most recent call last): File "/root/awsv4.py", line 25, in <module> print conn.create_bucket("test") File "/usr/lib/python2.7/site-packages/boto/s3/connection.py", line 616, in create_bucket data=data) File "/usr/lib/python2.7/site-packages/boto/s3/connection.py", line 668, in make_request retry_handler=retry_handler File "/usr/lib/python2.7/site-packages/boto/connection.py", line 1071, in make_request retry_handler=retry_handler) File "/usr/lib/python2.7/site-packages/boto/connection.py", line 927, in _mexe request.authorize(connection=self) File "/usr/lib/python2.7/site-packages/boto/connection.py", line 377, in authorize connection._auth_handler.add_auth(self, **kwargs) File "/usr/lib/python2.7/site-packages/boto/auth.py", line 723, in add_auth **kwargs) File "/usr/lib/python2.7/site-packages/boto/auth.py", line 542, in add_auth string_to_sign = self.string_to_sign(req, canonical_request) File "/usr/lib/python2.7/site-packages/boto/auth.py", line 482, in string_to_sign sts.append(self.credential_scope(http_request)) File "/usr/lib/python2.7/site-packages/boto/auth.py", line 464, in credential_scope region_name = self.determine_region_name(http_request.host) File "/usr/lib/python2.7/site-packages/boto/auth.py", line 658, in determine_region_name return region_name UnboundLocalError: local variable 'region_name' referenced before assignment Thanks Matt Benjamin. As a workaround, I am setting region_name in boto to empty string to get it working.