发起问题
0

通过python sdk调用openstack api 报错

提问于 2015-07-13 21:04:31 -0500

pyhaobo_ 图像
from libcloud.compute.types import Provider 
from libcloud.compute.providers import get_driver

auth_username = 'admin' 
auth_password = 'admin_pass' 
auth_url = 'http://200.21.40.62:5000/v2.0/' 
project_name = 'admin' 
region_name = ''

provider = get_driver(Provider.OPENSTACK) 
conn = provider(auth_username, 
                auth_password, 
                ex_force_auth_url = auth_url, 
                ex_force_auth_version='2.0_password', 
                ex_tenant_name = project_name, 
                ex_force_service_region = region_name) 

images = conn.list_images() 
for i in images: 
    print(i)

Exception: {"error": {"message": "get_version_v2() got an unexpected keyword argument 'auth'", "code": 400, "title": "Bad Request"}}

edit retag flag offensive close merge delete
0

回答 2015-07-21 01:39:53 -0500

The error you get from OpenStack:

"get_version_v2() got an unexpected keyword argument 'auth'\"

This is because of the authentication URL. I had the same problem while using libcloud to connect to the OpenStack API.

What I was trying: http://localhost:5000/v2.0/

The solution: http://localhost:5000/ http://localhost:5000/v2.0/tokens/

参考:http://stackoverflow.com/questions/23479120/kitchen-openstack-steps-example

edit flag offensive delete link 更多

你的回答

Please start posting anonymously - your entry will be published after you log in or create a new account.

开始回答

提问工具

1 follower

统计

已提问: 2015-07-13 21:04:31 -0500

已查看: 559 次

最后更新: Jul 21 '15