Mario Oschwald created LIBCLOUD-840:
---------------------------------------

             Summary: libcloud crashs when accessing Swift based object store 
using Keystone auth API v3
                 Key: LIBCLOUD-840
                 URL: https://issues.apache.org/jira/browse/LIBCLOUD-840
             Project: Libcloud
          Issue Type: Bug
          Components: Storage
         Environment: ANY
            Reporter: Mario Oschwald
            Priority: Critical


libcloud crashs when accessing Swift based object store using Keystone auth API 
v3

Code to reproduce:
{code}
from libcloud.storage.types import Provider
from libcloud.storage.providers import get_driver

cls = get_driver(Provider.OPENSTACK_SWIFT)
driver = cls('USER', 'PASSWORD', ex_force_auth_version='3.x_password',  
ex_force_auth_url='https://keystone.cst.de:5001',
ex_tenant_name='signing_service', ex_domain_name='AD', 
ex_force_service_name='ceph')
container = driver.create_container(container_name='fnord')
{code}

This produces the following stack trace:

{code}
Traceback (most recent call last):
  File "D:/DEV/MAIN/Release Management/bin/cstutil/cloudtools.py", line 18, in 
<module>
    main()
  File "D:/DEV/MAIN/Release Management/bin/cstutil/cloudtools.py", line 14, in 
main
    container = driver.create_container(container_name='fnord')
  File "C:\Python27\lib\site-packages\libcloud\storage\drivers\cloudfiles.py", 
line 358, in create_container
    '/%s' % (container_name_encoded), method='PUT')
  File "C:\Python27\lib\site-packages\libcloud\storage\drivers\cloudfiles.py", 
line 163, in request
    raw=raw)
  File "C:\Python27\lib\site-packages\libcloud\common\openstack.py", line 227, 
in request
    raw=raw)
  File "C:\Python27\lib\site-packages\libcloud\common\base.py", line 753, in 
request
    action = self.morph_action_hook(action)
  File "C:\Python27\lib\site-packages\libcloud\common\openstack.py", line 294, 
in morph_action_hook
    self._populate_hosts_and_request_paths()
  File "C:\Python27\lib\site-packages\libcloud\common\openstack.py", line 338, 
in _populate_hosts_and_request_paths
    url = self._ex_force_base_url or self.get_endpoint()
  File "C:\Python27\lib\site-packages\libcloud\storage\drivers\cloudfiles.py", 
line 141, in get_endpoint
    if endpoint:
UnboundLocalError: local variable 'endpoint' referenced before assignment
{code}

Please see attached patch for a trivial fix. Using the 2.0 endpoint locator
mechanism works fine with 3.x



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to