Page MenuHomePhabricator
Paste P9270

Keystone v2 API not working?

Authored by Krenair on Tue, Oct 8, 9:22 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.
>>> from keystoneauth1.identity import v2
>>> from keystoneauth1 import session
>>> from novaclient import client as novaclient
>>> username='novaobserver'
>>> password='Fs6Dq2RtG8KwmM2Z' # it's the public guest password
>>> tenant_name='observer'
>>> auth_url=''
>>> auth = v2.Password(username=username, password=password, tenant_name=tenant_name, auth_url=auth_url)
>>> sess = session.Session(auth=auth)
>>> client = novaclient.Client("2.0", session=sess, region_name='eqiad1-r')
>>> for s in client.servers.list():
... print(s)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/dist-packages/novaclient/v2/", line 749, in list
File "/usr/lib/python2.7/dist-packages/novaclient/", line 242, in _list
resp, body = self.api.client.get(url)
File "/usr/lib/python2.7/dist-packages/keystoneauth1/", line 173, in get
return self.request(url, 'GET', **kwargs)
File "/usr/lib/python2.7/dist-packages/novaclient/", line 89, in request
File "/usr/lib/python2.7/dist-packages/keystoneauth1/", line 331, in request
resp = super(LegacyJsonAdapter, self).request(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/keystoneauth1/", line 98, in request
return self.session.request(url, method, **kwargs)
File "/usr/lib/python2.7/dist-packages/positional/", line 94, in inner
return func(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/keystoneauth1/", line 370, in request
auth_headers = self.get_auth_headers(auth)
File "/usr/lib/python2.7/dist-packages/keystoneauth1/", line 624, in get_auth_headers
return auth.get_headers(self, **kwargs)
File "/usr/lib/python2.7/dist-packages/keystoneauth1/", line 84, in get_headers
token = self.get_token(session)
File "/usr/lib/python2.7/dist-packages/keystoneauth1/identity/", line 90, in get_token
return self.get_access(session).auth_token
File "/usr/lib/python2.7/dist-packages/keystoneauth1/identity/", line 136, in get_access
self.auth_ref = self.get_auth_ref(session)
File "/usr/lib/python2.7/dist-packages/keystoneauth1/identity/", line 65, in get_auth_ref
authenticated=False, log=False)
File "/usr/lib/python2.7/dist-packages/keystoneauth1/", line 572, in post
return self.request(url, 'POST', **kwargs)
File "/usr/lib/python2.7/dist-packages/positional/", line 94, in inner
return func(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/keystoneauth1/", line 467, in request
raise exceptions.from_response(resp, method, url)
keystoneauth1.exceptions.http.Unauthorized: The request you have made requires authentication. (HTTP 401) (Request-ID: req-751898a0-9051-4191-89fa-6b9ea76f64a0)

Event Timeline

Krenair created this paste.Tue, Oct 8, 9:22 PM