I'm sending on personnel ID as my posts to ceph-users@lists.ceph.com  are
not reaching to the mailing list, though I've subscribed.



On Tue, Jun 14, 2016 at 2:49 PM, Parveen Sharma <parveenks....@gmail.com>
wrote:

>
> Hi,
>
> I'm getting "UnboundLocalError: local variable 'region_name' referenced
> before assignment"  error while placing an object in my earlier created
> bucket using my RADOSGW with boto.
>
>
> My package details:
>
> $ 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'>>>
>
>
>
> https://bugzilla.redhat.com/show_bug.cgi?id=1343813  is mentioning a
> workaround but it apparently not working for me or I am missing something.
>
>
> *$ cat ~/.boto *
>
> [Credentials]
>
> aws_access_key_id = XXXXXXXXX
>
> aws_secret_access_key = YYYYYYYYYYYYYYYYYYY
>
>
> [s3]
>
> use-sigv4 = True
>
> $
>
> $
>
> *$ cat  s3test_for_placing_object_in_bucket.py*
>
> import boto
>
> import boto.s3.connection
>
>
>
> conn = boto.connect_s3(
>
>         host = 'mc2', port = 7480,
>
>         is_secure=False, calling_format =
> boto.s3.connection.OrdinaryCallingFormat(),
>
>         )
>
> #From
> http://stackoverflow.com/questions/15085864/how-to-upload-a-file-to-directory-in-s3-bucket-using-boto
>
> bucket = conn.get_bucket('my-new-bucket')
>
> key = boto.s3.key.Key(bucket, 'myTestFileIn_my-new-bucket.txt')
>
> with open('myTestFileIn_my-new-bucket.txt') as f:
>
> key.send_file(f)
>
> $
>
> $
>
> *$ python s3test_for_placing_object_in_bucket.py*
>
> Traceback (most recent call last):
>
>   File "s3test_for_placing_object_in_bucket.py", line 12, in <module>
>
>     bucket = conn.get_bucket('my-new-bucket')
>
>   File "/Library/Python/2.7/site-packages/boto/s3/connection.py", line
> 506, in get_bucket
>
>     return self.head_bucket(bucket_name, headers=headers)
>
>   File "/Library/Python/2.7/site-packages/boto/s3/connection.py", line
> 525, in head_bucket
>
>     response = self.make_request('HEAD', bucket_name, headers=headers)
>
>   File "/Library/Python/2.7/site-packages/boto/s3/connection.py", line
> 668, in make_request
>
>     retry_handler=retry_handler
>
>   File "/Library/Python/2.7/site-packages/boto/connection.py", line 1071,
> in make_request
>
>     retry_handler=retry_handler)
>
>   File "/Library/Python/2.7/site-packages/boto/connection.py", line 927,
> in _mexe
>
>     request.authorize(connection=self)
>
>   File "/Library/Python/2.7/site-packages/boto/connection.py", line 377,
> in authorize
>
>     connection._auth_handler.add_auth(self, **kwargs)
>
>   File "/Library/Python/2.7/site-packages/boto/auth.py", line 722, in
> add_auth
>
>     **kwargs)
>
>   File "/Library/Python/2.7/site-packages/boto/auth.py", line 542, in
> add_auth
>
>     string_to_sign = self.string_to_sign(req, canonical_request)
>
>   File "/Library/Python/2.7/site-packages/boto/auth.py", line 482, in
> string_to_sign
>
>     sts.append(self.credential_scope(http_request))
>
>   File "/Library/Python/2.7/site-packages/boto/auth.py", line 464, in
> credential_scope
>
>     region_name = self.determine_region_name(http_request.host)
>
>   File "/Library/Python/2.7/site-packages/boto/auth.py", line 657, in
> determine_region_name
>
>     return region_name
>
> *UnboundLocalError: local variable 'region_name' referenced before
> assignment*
>
> $
>
>
> -
>
> Parveen
>
>
>
_______________________________________________
ceph-users mailing list
ceph-users@lists.ceph.com
http://lists.ceph.com/listinfo.cgi/ceph-users-ceph.com

Reply via email to