Page MenuHomePhabricator
Paste P9271

Keystone v3 API working with debug
ActivePublic

Authored by Krenair on Tue, Oct 8, 10:01 PM.
krenair@shinken-02:~$ python
Python 2.7.9 (default, Sep 14 2019, 20:00:08)
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import logging
>>>
>>>
>>> from keystoneclient.session import Session as KeystoneSession
>>> from keystoneclient.auth.identity.v3 import Password as KeystonePassword
>>> from keystoneclient.v3 import Client as KeystoneClient
>>>
>>> from novaclient import client as novaclient
>>>
>>> logging.basicConfig(level=logging.DEBUG)
>>>
>>> username='novaobserver'
>>> password='Fs6Dq2RtG8KwmM2Z' # public guest password
>>> tenant_name='observer'
>>> auth_url='http://cloudcontrol1003.wikimedia.org:5000/v3'
>>> auth = KeystonePassword(username=username, password=password, project_name=tenant_name, auth_url=auth_url, user_domain_name='default', project_domain_name='default')
>>>
>>>
>>> sess = KeystoneSession(auth=auth)
>>>
>>> client = novaclient.Client("2.0", session=sess, region_name='eqiad1-r')
>>> for s in client.servers.list():
... print(s)
...
DEBUG:keystoneclient.auth.identity.v3.base:Making authentication request to http://cloudcontrol1003.wikimedia.org:5000/v3/auth/tokens
DEBUG:requests.packages.urllib3.connectionpool:Starting new HTTP connection (1): cloudcontrol1003.wikimedia.org
DEBUG:requests.packages.urllib3.connectionpool:http://cloudcontrol1003.wikimedia.org:5000 "POST /v3/auth/tokens HTTP/1.1" 201 4158
DEBUG:keystoneclient.session:REQ: curl -g -i -X GET http://cloudcontrol1003.wikimedia.org:8774/v2.1/servers/detail -H "User-Agent: python-novaclient" -H "Accept: application/json" -H "X-Auth-Token: {SHA1}4816a6db9fae93c14b53629aa24a56d41d13ad27"
DEBUG:requests.packages.urllib3.connectionpool:Starting new HTTP connection (1): cloudcontrol1003.wikimedia.org
DEBUG:requests.packages.urllib3.connectionpool:http://cloudcontrol1003.wikimedia.org:8774 "GET /v2.1/servers/detail HTTP/1.1" 200 15
DEBUG:keystoneclient.session:RESP: [200] Content-Length: 15 Content-Type: application/json Openstack-Api-Version: compute 2.1 X-Openstack-Nova-Api-Version: 2.1 Vary: OpenStack-API-Version, X-OpenStack-Nova-API-Version X-Compute-Request-Id: req-af3ac1e2-6986-42fb-be60-e39893ac0364 Date: Tue, 08 Oct 2019 22:00:54 GMT Connection: close
RESP BODY: {"servers": []}

Event Timeline

Krenair created this paste.Tue, Oct 8, 10:01 PM