[openstack-dev] 3-rd party endpoint lookup and interpolation

Adam Young ayoung at redhat.com
Wed Aug 1 20:55:21 UTC 2012


I think that this pattern ( "do on behalf of") is going to be very common.  I'll take a look at the V3 API and see if we have it covered.


----- Original Message -----
From: "Pete Zaitcev" <zaitcev at redhat.com>
To: "OpenStack Development Mailing List" <openstack-dev at lists.openstack.org>
Cc: ayoung at redhat.com
Sent: Wednesday, August 1, 2012 2:11:57 PM
Subject: Re: [openstack-dev] 3-rd party endpoint lookup and interpolation

On Tue, 31 Jul 2012 11:56:32 -0400
Adam Young <ayoung at redhat.com> wrote:

> > So, ideally I would like an API call that permits an administrator account
> > to submit own credentials, but look up and interpolate someone else's
> > StorageURL. Do we have such a call?
> 
> Did you ever get an answer?  What approach did you take?

I ran with the double-list for now, like this:

def find_storage_url(par, keystone):

    slist = keystone.services.list()
    swift_svc = None
    for svc in slist:
        if svc.type == 'object-store':
            swift_svc = svc
    if not swift_svc:
        raise LocalError("No 'object-store' service")

    elist = keystone.endpoints.list()
    swift_ep = None
    for ep in elist:
        if ep.service_id == swift_svc.id:
            swift_ep = ep
            break
    if not swift_ep:
        raise LocalError("No endpoint for service id %s" % swift_svc.id)
    return swift_ep.publicurl

Although cumbersome, this is not called for every user, and only
loops across the limited number of services and endpoints, not across
all users. So it's acceptable, just annoying. I do not demand that
we enhance Keystone API for this use case.

-- Pete



More information about the OpenStack-dev mailing list