← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1406722] [NEW] Creating endpoint using service without name causes getting token fail

 

Public bug reported:

Steps to reproduce:

1. Create a service without name using v2 api (Keystone client doesn't allow creating a service without name but it's OK for REST api).
curl -i -X POST http://localhost:35357/v2.0/OS-KSADM/services -H "Accept: application/json" -H "X-Auth-Token: $TOKEN" -H "Content-Type: application/json" -d '{ "OS-KSADM:service": { "type": "test" } }'

2. Create a endpoint with this service using v2 api.
curl -i -X POST http://localhost:35357/v2.0/endpoints -H "Content-Type: application/json" -H "Accept: application/json" -H "X-Auth-Token: $TOKEN" -d '{ "endpoint": { "adminurl": null, "service_id": "6d86286bbc744a32b9295c542fefb4ed", "region": "regionOne", "internalurl": null, "publicurl": "http://localhost:8888"; } }'

3. Try to get a new token using v2 api and fail.
curl -i -H "Content-Type: application/json" -d '{ "auth": { "tenantName": "demo", "passwordCredentials": { "username": "admin", "password": "$PASSWORD" } } }' http://localhost:5000/v2.0/tokens

HTTP/1.1 500 Internal Server Error
Date: Wed, 31 Dec 2014 07:32:36 GMT
Server: Apache/2.4.7 (Ubuntu)
Vary: X-Auth-Token
Content-Length: 232
Connection: close
Content-Type: application/json

{"error": {"message": "An unexpected error prevented the server from
fulfilling your request: 'Service' object has no attribute 'name'
(Disable debug mode to suppress these details.)", "code": 500, "title":
"Internal Server Error"}}

The problem is that, get token v2 api will also return catalog
information. Endpoints are traversed to form the catalog dict. When the
name attribute of the un-named service is accessed, an error occurs. V3
api doesn't have this problem since name attribute is checked if none
before access.

** Affects: keystone
     Importance: Undecided
     Assignee: Zhiyuan Cai (luckyvega-g)
         Status: New

** Changed in: keystone
     Assignee: (unassigned) => Zhiyuan Cai (luckyvega-g)

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to Keystone.
https://bugs.launchpad.net/bugs/1406722

Title:
  Creating endpoint using service without name causes getting token fail

Status in OpenStack Identity (Keystone):
  New

Bug description:
  Steps to reproduce:

  1. Create a service without name using v2 api (Keystone client doesn't allow creating a service without name but it's OK for REST api).
  curl -i -X POST http://localhost:35357/v2.0/OS-KSADM/services -H "Accept: application/json" -H "X-Auth-Token: $TOKEN" -H "Content-Type: application/json" -d '{ "OS-KSADM:service": { "type": "test" } }'

  2. Create a endpoint with this service using v2 api.
  curl -i -X POST http://localhost:35357/v2.0/endpoints -H "Content-Type: application/json" -H "Accept: application/json" -H "X-Auth-Token: $TOKEN" -d '{ "endpoint": { "adminurl": null, "service_id": "6d86286bbc744a32b9295c542fefb4ed", "region": "regionOne", "internalurl": null, "publicurl": "http://localhost:8888"; } }'

  3. Try to get a new token using v2 api and fail.
  curl -i -H "Content-Type: application/json" -d '{ "auth": { "tenantName": "demo", "passwordCredentials": { "username": "admin", "password": "$PASSWORD" } } }' http://localhost:5000/v2.0/tokens

  HTTP/1.1 500 Internal Server Error
  Date: Wed, 31 Dec 2014 07:32:36 GMT
  Server: Apache/2.4.7 (Ubuntu)
  Vary: X-Auth-Token
  Content-Length: 232
  Connection: close
  Content-Type: application/json

  {"error": {"message": "An unexpected error prevented the server from
  fulfilling your request: 'Service' object has no attribute 'name'
  (Disable debug mode to suppress these details.)", "code": 500,
  "title": "Internal Server Error"}}

  The problem is that, get token v2 api will also return catalog
  information. Endpoints are traversed to form the catalog dict. When
  the name attribute of the un-named service is accessed, an error
  occurs. V3 api doesn't have this problem since name attribute is
  checked if none before access.

To manage notifications about this bug go to:
https://bugs.launchpad.net/keystone/+bug/1406722/+subscriptions


Follow ups

References