Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Paste
P9270
Keystone v2 API not working?
Active
Public
Actions
Authored by
Krenair
on Oct 8 2019, 9:22 PM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Flag For Later
Tags
None
Referenced Files
F30594844: raw.txt
Oct 8 2019, 9:22 PM
2019-10-08 21:22:16 (UTC+0)
Subscribers
None
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
=
'http://cloudcontrol1003.wikimedia.org:5000/v2.0'
>>>
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/servers.py"
,
line
749
,
in
list
"servers"
)
File
"/usr/lib/python2.7/dist-packages/novaclient/base.py"
,
line
242
,
in
_list
resp
,
body
=
self
.
api
.
client
.
get
(
url
)
File
"/usr/lib/python2.7/dist-packages/keystoneauth1/adapter.py"
,
line
173
,
in
get
return
self
.
request
(
url
,
'GET'
,
**
kwargs
)
File
"/usr/lib/python2.7/dist-packages/novaclient/client.py"
,
line
89
,
in
request
**
kwargs
)
File
"/usr/lib/python2.7/dist-packages/keystoneauth1/adapter.py"
,
line
331
,
in
request
resp
=
super
(
LegacyJsonAdapter
,
self
)
.
request
(
*
args
,
**
kwargs
)
File
"/usr/lib/python2.7/dist-packages/keystoneauth1/adapter.py"
,
line
98
,
in
request
return
self
.
session
.
request
(
url
,
method
,
**
kwargs
)
File
"/usr/lib/python2.7/dist-packages/positional/__init__.py"
,
line
94
,
in
inner
return
func
(
*
args
,
**
kwargs
)
File
"/usr/lib/python2.7/dist-packages/keystoneauth1/session.py"
,
line
370
,
in
request
auth_headers
=
self
.
get_auth_headers
(
auth
)
File
"/usr/lib/python2.7/dist-packages/keystoneauth1/session.py"
,
line
624
,
in
get_auth_headers
return
auth
.
get_headers
(
self
,
**
kwargs
)
File
"/usr/lib/python2.7/dist-packages/keystoneauth1/plugin.py"
,
line
84
,
in
get_headers
token
=
self
.
get_token
(
session
)
File
"/usr/lib/python2.7/dist-packages/keystoneauth1/identity/base.py"
,
line
90
,
in
get_token
return
self
.
get_access
(
session
)
.
auth_token
File
"/usr/lib/python2.7/dist-packages/keystoneauth1/identity/base.py"
,
line
136
,
in
get_access
self
.
auth_ref
=
self
.
get_auth_ref
(
session
)
File
"/usr/lib/python2.7/dist-packages/keystoneauth1/identity/v2.py"
,
line
65
,
in
get_auth_ref
authenticated
=
False
,
log
=
False
)
File
"/usr/lib/python2.7/dist-packages/keystoneauth1/session.py"
,
line
572
,
in
post
return
self
.
request
(
url
,
'POST'
,
**
kwargs
)
File
"/usr/lib/python2.7/dist-packages/positional/__init__.py"
,
line
94
,
in
inner
return
func
(
*
args
,
**
kwargs
)
File
"/usr/lib/python2.7/dist-packages/keystoneauth1/session.py"
,
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
-
751898
a0
-
9051
-
4191
-
89
fa
-
6
b9ea76f64a0
)
Event Timeline
Krenair
created this paste.
Oct 8 2019, 9:22 PM
2019-10-08 21:22:16 (UTC+0)
Log In to Comment