I have been trying to make a simple connection to Openstack cloud using python-openstack sdk. With no success. Can someone tell me where I am going wrong? I can see that the header is sending something else entirely instead of the token of authentication, but I don't know how to change that. Here is the code:
import openstack
import sys
conn=connection.Connection(
auth_url='https://fra1.citycloud.com:5000',
project_name="Default Project 39140",
username="vishwa",
password="********",
user_domain_id="99c442651eb84358a515c42e4e6b3acb",
project_domain_id="221c17841e5640f5953c22c28c3872e6")
for servers in conn.compute.servers():
print(server.name)
and here is the response:
REQ: curl -g -i -X GET https://fra1.citycloud.com:5000 -H "Accept: application/json" -H "**User-Agent: openstacksdk/0.53.0 keystoneauth1/4.3.0 python-requests/2.25.1 CPython/3.7.0**"
RESP: [300] Connection: close Content-Length: 274 Content-Type: application/json Date: Sun, 28 Feb 2021 03:22:48 GMT Location: https://fra1.citycloud.com:5000/v3/ Server: nginx/1.14.0 (Ubuntu) Vary: X-Auth-Token x-openstack-request-id: req-cf7cfc97-92af-4f26-9afc-e65b72d26f26
RESP BODY: {"versions": {"values": [{"id": "v3.13", "status": "stable", "updated": "2019-07-19T00:00:00Z", "links": [{"rel": "self", "href": "https://fra1.citycloud.com:5000/v3/"}], "media-types": [{"base": "application/json", "type": "application/vnd.openstack.identity-v3+json"}]}]}}
GET call to https://fra1.citycloud.com:5000/ used request id req-cf7cfc97-92af-4f26-9afc-e65b72d26f26
Making authentication request to https://fra1.citycloud.com:5000/v3/auth/tokens
Request returned failure status: 401
If you look at that. you can see that the "header" is sending 'agent-..' instead of credentials: {username:...,pass:} Some more details: The city cloud has its own api, I know it uses tokens to authenticate-version 3. I had been able to do it with their API, but am struggling with using openstack api. Thanks
0 Answers