← Back to team overview

openstack team mailing list archive

Re: 401 Not Authorized from glance - How to fix ?

 

Several thoughts to ponder. One is, the nova image-list command is
using the Compute API, not the Image API. You can turn on --debug to
see the curl statement issued from the nova client (very handy, that).
Do:
nova --debug image-list
to see what I mean.

Also note there's a new bugfix for python-novaclient
(https://review.openstack.org/#/c/7200/) that fixes a problem with
prettyprint 0.6 removing printt (so it uses get_string now with the
latest version).

Also, I'd definitely point you to this guide as it has drop-in python
code for requesting a token:
http://docs.openstack.org/api/openstack-compute/programmer/content/using-python-to-obtain-the-authentication-token.html

Usually when I get an error from the Image API (Glance) it's because I
didn't put the proper paste-deploy filter in one of the Glance conf
files. If you're the cloud admin in this case, double-check your
glance config with:
http://docs.openstack.org/trunk/openstack-compute/install/content/configure-glance-files.html

If you're not the cloud admin, also know that the Image API isn't
publicly available on many public clouds such as TryStack.

Hope this is helpful.
Anne

On Fri, Jun 1, 2012 at 12:20 PM, Mandar Vaze / मंदार वझे
<mandarvaze@xxxxxxxxx> wrote:
> Hi,
>
> I'm working on python program that needs to get images detail from glance.
> I was using "get_admin_context" earlier to do all the work in nova side, but
> this doesn't seem to work when I query glance.
> I get "401 Not Authorized" error.
>
> I think I need to get auth_token from keystone, and use it when creating
> RequestContext object - then glance query might work. (Is this assumption
> correct, in the first place)  But I do not know how to do this
> programatically, I looked at "nova image-list" command, but I didn't get
> clear picture on how this should be done.
>
> Can you point to any existing code that authenticates with keystone and then
> uses the auth-token to talk to glance ?
>
> Thanks,
> -Mandar
>
> _______________________________________________
> Mailing list: https://launchpad.net/~openstack
> Post to     : openstack@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~openstack
> More help   : https://help.launchpad.net/ListHelp
>


Follow ups

References