I tried this approach with the following command line:

$ keystone --debug tenant-get '{name=Jet-Home}'

It didn't work; it seems that it doesn't work because it doesn't like the proposed syntax:

DEBUG:keystoneclient.auth.identity.v2:Making authentication request to https://proxy.nebula-dev:8770/v2.0/tokens INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): proxy.nebula-dev DEBUG:requests.packages.urllib3.connectionpool:"POST /v2.0/tokens HTTP/1.1" 200 2966

Looks like it generated the right call:

DEBUG:keystoneclient.session:REQ: curl -i -X GET https://proxy.nebula-dev:35357/v2.0/tenants/{name=Jet-Home} -H "User-Agent: python-keystoneclient" -H "X-Auth-Token: TOKEN_REDACTED" INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): proxy.nebula-dev DEBUG:requests.packages.urllib3.connectionpool:"GET /v2.0/tenants/%7Bname=Jet-Home%7D HTTP/1.1" 404 101

But it didn't like that (404 not found):

DEBUG:keystoneclient.session:RESP:
DEBUG:keystoneclient.session:Request returned failure status: 404

This is where it falls back to fetching all tenants to search within the list client-side:

DEBUG:keystoneclient.session:REQ: curl -i -X GET https://proxy.nebula-dev:35357/v2.0/tenants -H "User-Agent: python-keystoneclient" -H "X-Auth-Token: TOKEN_REDACTED" INFO:requests.packages.urllib3.connectionpool:Starting new HTTPS connection (1): proxy.nebula-dev DEBUG:requests.packages.urllib3.connectionpool:"GET /v2.0/tenants HTTP/1.1" 200 963
[...]

On 1/9/2015 *李旦* lidan17 at jd.com <mailto:openstack%40lists.openstack.org?Subject=Re%3A%20%5BOpenstack%5D%20Get%20tenant%20by%20name&In-Reply-To=%3CA0257811F020DE4698F0891EF93864DB0132E5A1%40mbx04.360buyAD.local%3E> wrote:
Maybe you need:
curl -i -X GEThttp://IPAddr:35357/v2.0/tenants?{name=XXXX  
<http://IPAddr:35357/v2.0/tenants?%7Bname=XXXX>} -H "User-Agent: python-keystoneclient" 
-H "X-Auth-Token: XXXXXXXXXXXXXXXXXXXXXX"

Hope this helps.

Best Regards,
Daniel

On 1/8/2015 5:42 PM, Peter Scott wrote:
Hello. The v2.0 API documentation at http://developer.openstack.org/api-ref-identity-v2.html says that it is possible to look up a tenant by name. It comes right after the "list all tenants" call and looks the same, although if I understand it correctly it takes a request body with a 'name' parameter.

However, I can't find any Python support for that lookup nor a curl example. Can someone supply either a curl example or a python call that looks up a tenant by name please?

_______________________________________________
Mailing list: http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
Post to     : [email protected]
Unsubscribe : http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack

Reply via email to