[openstack-dev] 3-rd party endpoint lookup and interpolation
Pete Zaitcev
zaitcev at redhat.com
Wed Aug 1 18:11:57 UTC 2012
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