Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Swift authentification probelm

Hello everyone, I am a team member of research group and my current research needs to use Openstack Swift. We have installed Openstack Juno and it works perfectly. For installation Packstack have used used. The swift service is also installed on the server and it works! We have tried to access it from the console create container, upload a file etc. everything works. So we went further and tried to access swift using its API. Here we faced a problem on the phase of authentication.

Below you can see the simple python code I am using to check if I can connect to Swift.

import swiftclient
import keystoneclient 


conn = swiftclient.Connection(
            authurl='http://*[server ip]*:5000/v2.0/',
                                    user='account_name:username',
                                    key='serverpassword',
                                    auth_version="2.0").get_auth()[0]  

for container in conn.get_account()[1]:
       print container['name']

Before executing the cod I have installed the following necessary packages.

sudo aptitude install python-pip
sudo pip install python-swiftclient
sudo pip install python-keystoneclient

Here you can see the error which occurs during execution of the code.

Traceback (most recent call last):
  File "new.py", line 15, in <module>
    auth_version="2.0").get_auth()[0]
  File "/usr/local/lib/python2.7/dist-packages/swiftclient/client.py", line 1332, in get_auth
    timeout=self.timeout)
  File "/usr/local/lib/python2.7/dist-packages/swiftclient/client.py", line 463, in get_auth
    auth_version=auth_version)
  File "/usr/local/lib/python2.7/dist-packages/swiftclient/client.py", line 366, in get_auth_keystone
    ksclient, exceptions = _import_keystone_client(auth_version)
  File "/usr/local/lib/python2.7/dist-packages/swiftclient/client.py", line 351, in _import_keystone_client
    variables to be set or overridden with -A, -U, or -K.''')
swiftclient.exceptions.ClientException: 
Auth versions 2.0 and 3 require python-keystoneclient, install it or use Auth
version 1.0 which requires ST_AUTH, ST_USER, and ST_KEY environment
variables to be set or overridden with -A, -U, or -K.

I have tried to find the solution searching in the Internet but I have not succeed. Thank you in advance!