← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1733746] [NEW] Failed to get flavors(raise 500) with a domain scope(without project_id).

 

Public bug reported:


Description
===========
Failed to get flavors(raise a 500 error) with a domain scope
or unscope token(without project_id).

https://docs.openstack.org/keystone/pike/admin/identity-tokens.html
#domain-scoped-tokens

Steps to reproduce
==================

1. Get a unscope token or domain token.
TOKEN=`curl -i -X POST http://10.76.6.31/identity/v3/auth/tokens -H "Accept: application/json" -H "Content-Type: application/json" -d '{"auth":{"identity":{"methods":["password"],"password":{"user":{"domain":{"name":"default"},"name":"admin","password":"xxx"}}}}}' | grep X-Subject-Token | awk '{ print $2 }’`

2. Get flavors.
curl -g -i -X GET http://10.76.6.31/compute/v2.1/flavors/detail -H "OpenStack-API-Version: compute 2.53" -H "User-Agent: python-novaclient" -H "Accept: application/json" -H "X-OpenStack-Nova-API-Version: 2.53" -H "X-Auth-Token: $TOKEN"


Expected result
===============
Get flavors back.

Actual result
=============
HTTP/1.1 500 Internal Server Error
Date: Fri, 17 Nov 2017 09:22:38 GMT
Server: Apache/2.4.18 (Ubuntu)
OpenStack-API-Version: compute 2.53
X-OpenStack-Nova-API-Version: 2.53
Vary: OpenStack-API-Version,X-OpenStack-Nova-API-Version
Content-Type: application/json; charset=UTF-8
Content-Length: 193
x-openstack-request-id: req-f77858f8-dd77-4dcd-825a-aec012cabcfc
x-compute-request-id: req-f77858f8-dd77-4dcd-825a-aec012cabcfc
Connection: close
{"computeFault": {"message": "Unexpected API Error. Please report this at http://bugs.launchpad.net/nova/ and attach the Nova API log if possible.\n<type 'exceptions.TypeError'>", "code": 500}}


Logs & Configs
==============
2017-11-19 20:19:03.567 9606 INFO sqlalchemy.engine.base.Engine [req-c1765f1e-786a-4457-9c45-2f8c3897722b - admin] ROLLBACK
2017-11-19 20:19:03.571 9606 ERROR nova.api.openstack.extensions [req-c1765f1e-786a-4457-9c45-2f8c3897722b - admin] Unexpected exception in API method: TypeError: 'in <string>' requires string as left operand, not NoneType
2017-11-19 20:19:03.571 9606 ERROR nova.api.openstack.extensions Traceback (most recent call last):
2017-11-19 20:19:03.571 9606 ERROR nova.api.openstack.extensions   File "/opt/stack/nova/nova/api/openstack/extensions.py", line 336, in wrapped
2017-11-19 20:19:03.571 9606 ERROR nova.api.openstack.extensions     return f(*args, **kwargs)
2017-11-19 20:19:03.571 9606 ERROR nova.api.openstack.extensions   File "/opt/stack/nova/nova/api/openstack/compute/flavors.py", line 48, in detail
2017-11-19 20:19:03.571 9606 ERROR nova.api.openstack.extensions     return self._view_builder.detail(req, limited_flavors)
2017-11-19 20:19:03.571 9606 ERROR nova.api.openstack.extensions   File "/opt/stack/nova/nova/api/openstack/compute/views/flavors.py", line 61, in detail
2017-11-19 20:19:03.571 9606 ERROR nova.api.openstack.extensions     return self._list_view(self.show, request, flavors, coll_name)
2017-11-19 20:19:03.571 9606 ERROR nova.api.openstack.extensions   File "/opt/stack/nova/nova/api/openstack/compute/views/flavors.py", line 74, in _list_view
2017-11-19 20:19:03.571 9606 ERROR nova.api.openstack.extensions     flavor_list = [func(request, flavor)["flavor"] for flavor in flavors]
2017-11-19 20:19:03.571 9606 ERROR nova.api.openstack.extensions   File "/opt/stack/nova/nova/api/openstack/compute/views/flavors.py", line 47, in show
2017-11-19 20:19:03.571 9606 ERROR nova.api.openstack.extensions     self._collection_name),
2017-11-19 20:19:03.571 9606 ERROR nova.api.openstack.extensions   File "/opt/stack/nova/nova/api/openstack/common.py", line 390, in _get_links
2017-11-19 20:19:03.571 9606 ERROR nova.api.openstack.extensions     "href": self._get_href_link(request, identifier, collection_name),
2017-11-19 20:19:03.571 9606 ERROR nova.api.openstack.extensions   File "/opt/stack/nova/nova/api/openstack/common.py", line 413, in _get_href_link
2017-11-19 20:19:03.571 9606 ERROR nova.api.openstack.extensions     self._get_project_id(request),
2017-11-19 20:19:03.571 9606 ERROR nova.api.openstack.extensions   File "/opt/stack/nova/nova/api/openstack/common.py", line 383, in _get_project_id
2017-11-19 20:19:03.571 9606 ERROR nova.api.openstack.extensions     if project_id in request.url:#project_id and project_id in request.url:
2017-11-19 20:19:03.571 9606 ERROR nova.api.openstack.extensions TypeError: 'in <string>' requires string as left operand, not NoneType
2017-11-19 20:19:03.571 9606 ERROR nova.api.openstack.extensions
2017-11-19 20:19:03.598 9606 INFO nova.api.openstack.wsgi [req-c1765f1e-786a-4457-9c45-2f8c3897722b - admin] HTTP exception thrown: Unexpected API Error. Please report this at http://bugs.launchpad.net/nova/ and attach the Nova API log if possible.
<type 'exceptions.TypeError'>
2017-11-19 20:19:03.600 9606 DEBUG nova.api.openstack.wsgi [req-c1765f1e-786a-4457-9c45-2f8c3897722b - admin] Returning 500 to user: Unexpected API Error. Please report this at http://bugs.launchpad.net/nova/ and attach the Nova API log if possible.
<type 'exceptions.TypeError'> __call__ /opt/stack/nova/nova/api/openstack/wsgi.py:1029
2017-11-19 20:19:03.602 9606 INFO nova.api.openstack.requestlog [req-c1765f1e-786a-4457-9c45-2f8c3897722b - admin] 10.76.6.31 "GET /compute/v2.1/flavors/detail" status: 500 len: 193 microversion: 2.53 time: 0.711753

** Affects: nova
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1733746

Title:
  Failed to get flavors(raise 500) with a domain scope(without
  project_id).

Status in OpenStack Compute (nova):
  New

Bug description:

  Description
  ===========
  Failed to get flavors(raise a 500 error) with a domain scope
  or unscope token(without project_id).

  https://docs.openstack.org/keystone/pike/admin/identity-tokens.html
  #domain-scoped-tokens

  Steps to reproduce
  ==================

  1. Get a unscope token or domain token.
  TOKEN=`curl -i -X POST http://10.76.6.31/identity/v3/auth/tokens -H "Accept: application/json" -H "Content-Type: application/json" -d '{"auth":{"identity":{"methods":["password"],"password":{"user":{"domain":{"name":"default"},"name":"admin","password":"xxx"}}}}}' | grep X-Subject-Token | awk '{ print $2 }’`

  2. Get flavors.
  curl -g -i -X GET http://10.76.6.31/compute/v2.1/flavors/detail -H "OpenStack-API-Version: compute 2.53" -H "User-Agent: python-novaclient" -H "Accept: application/json" -H "X-OpenStack-Nova-API-Version: 2.53" -H "X-Auth-Token: $TOKEN"

  
  Expected result
  ===============
  Get flavors back.

  Actual result
  =============
  HTTP/1.1 500 Internal Server Error
  Date: Fri, 17 Nov 2017 09:22:38 GMT
  Server: Apache/2.4.18 (Ubuntu)
  OpenStack-API-Version: compute 2.53
  X-OpenStack-Nova-API-Version: 2.53
  Vary: OpenStack-API-Version,X-OpenStack-Nova-API-Version
  Content-Type: application/json; charset=UTF-8
  Content-Length: 193
  x-openstack-request-id: req-f77858f8-dd77-4dcd-825a-aec012cabcfc
  x-compute-request-id: req-f77858f8-dd77-4dcd-825a-aec012cabcfc
  Connection: close
  {"computeFault": {"message": "Unexpected API Error. Please report this at http://bugs.launchpad.net/nova/ and attach the Nova API log if possible.\n<type 'exceptions.TypeError'>", "code": 500}}

  
  Logs & Configs
  ==============
  2017-11-19 20:19:03.567 9606 INFO sqlalchemy.engine.base.Engine [req-c1765f1e-786a-4457-9c45-2f8c3897722b - admin] ROLLBACK
  2017-11-19 20:19:03.571 9606 ERROR nova.api.openstack.extensions [req-c1765f1e-786a-4457-9c45-2f8c3897722b - admin] Unexpected exception in API method: TypeError: 'in <string>' requires string as left operand, not NoneType
  2017-11-19 20:19:03.571 9606 ERROR nova.api.openstack.extensions Traceback (most recent call last):
  2017-11-19 20:19:03.571 9606 ERROR nova.api.openstack.extensions   File "/opt/stack/nova/nova/api/openstack/extensions.py", line 336, in wrapped
  2017-11-19 20:19:03.571 9606 ERROR nova.api.openstack.extensions     return f(*args, **kwargs)
  2017-11-19 20:19:03.571 9606 ERROR nova.api.openstack.extensions   File "/opt/stack/nova/nova/api/openstack/compute/flavors.py", line 48, in detail
  2017-11-19 20:19:03.571 9606 ERROR nova.api.openstack.extensions     return self._view_builder.detail(req, limited_flavors)
  2017-11-19 20:19:03.571 9606 ERROR nova.api.openstack.extensions   File "/opt/stack/nova/nova/api/openstack/compute/views/flavors.py", line 61, in detail
  2017-11-19 20:19:03.571 9606 ERROR nova.api.openstack.extensions     return self._list_view(self.show, request, flavors, coll_name)
  2017-11-19 20:19:03.571 9606 ERROR nova.api.openstack.extensions   File "/opt/stack/nova/nova/api/openstack/compute/views/flavors.py", line 74, in _list_view
  2017-11-19 20:19:03.571 9606 ERROR nova.api.openstack.extensions     flavor_list = [func(request, flavor)["flavor"] for flavor in flavors]
  2017-11-19 20:19:03.571 9606 ERROR nova.api.openstack.extensions   File "/opt/stack/nova/nova/api/openstack/compute/views/flavors.py", line 47, in show
  2017-11-19 20:19:03.571 9606 ERROR nova.api.openstack.extensions     self._collection_name),
  2017-11-19 20:19:03.571 9606 ERROR nova.api.openstack.extensions   File "/opt/stack/nova/nova/api/openstack/common.py", line 390, in _get_links
  2017-11-19 20:19:03.571 9606 ERROR nova.api.openstack.extensions     "href": self._get_href_link(request, identifier, collection_name),
  2017-11-19 20:19:03.571 9606 ERROR nova.api.openstack.extensions   File "/opt/stack/nova/nova/api/openstack/common.py", line 413, in _get_href_link
  2017-11-19 20:19:03.571 9606 ERROR nova.api.openstack.extensions     self._get_project_id(request),
  2017-11-19 20:19:03.571 9606 ERROR nova.api.openstack.extensions   File "/opt/stack/nova/nova/api/openstack/common.py", line 383, in _get_project_id
  2017-11-19 20:19:03.571 9606 ERROR nova.api.openstack.extensions     if project_id in request.url:#project_id and project_id in request.url:
  2017-11-19 20:19:03.571 9606 ERROR nova.api.openstack.extensions TypeError: 'in <string>' requires string as left operand, not NoneType
  2017-11-19 20:19:03.571 9606 ERROR nova.api.openstack.extensions
  2017-11-19 20:19:03.598 9606 INFO nova.api.openstack.wsgi [req-c1765f1e-786a-4457-9c45-2f8c3897722b - admin] HTTP exception thrown: Unexpected API Error. Please report this at http://bugs.launchpad.net/nova/ and attach the Nova API log if possible.
  <type 'exceptions.TypeError'>
  2017-11-19 20:19:03.600 9606 DEBUG nova.api.openstack.wsgi [req-c1765f1e-786a-4457-9c45-2f8c3897722b - admin] Returning 500 to user: Unexpected API Error. Please report this at http://bugs.launchpad.net/nova/ and attach the Nova API log if possible.
  <type 'exceptions.TypeError'> __call__ /opt/stack/nova/nova/api/openstack/wsgi.py:1029
  2017-11-19 20:19:03.602 9606 INFO nova.api.openstack.requestlog [req-c1765f1e-786a-4457-9c45-2f8c3897722b - admin] 10.76.6.31 "GET /compute/v2.1/flavors/detail" status: 500 len: 193 microversion: 2.53 time: 0.711753

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


Follow ups