Public bug reported:

Horizon breaks if "Instances page" "Image Name" filter is invoked and
there is an image without name exists.

How to reproduce:

1. Create an image without a name
image list --project 66ae0f36c4184e37b159ef3e9f39ea56 -c Name | more
+-------------------------------------------+
| Name                                      |
+-------------------------------------------+
| None                                      |
| bionic-server                             |
+-------------------------------------------+

2. Go to Instances tab
3. Put random value to "Image Name" field and press Filter


Error trace:

[Thu Jan 05 19:07:29.668641 2023] [:error] [pid 31] Traceback (most recent call 
last):
[Thu Jan 05 19:07:29.668647 2023] [:error] [pid 31]   File 
"/usr/lib/python2.7/site-packages/django/core/handlers/exception.py", line 41, 
in inner
[Thu Jan 05 19:07:29.668651 2023] [:error] [pid 31]     response = 
get_response(request)
[Thu Jan 05 19:07:29.668656 2023] [:error] [pid 31]   File 
"/usr/lib/python2.7/site-packages/django/core/handlers/base.py", line 187, in 
_get_response
[Thu Jan 05 19:07:29.668664 2023] [:error] [pid 31]     response = 
self.process_exception_by_middleware(e, request)
[Thu Jan 05 19:07:29.668669 2023] [:error] [pid 31]   File 
"/usr/lib/python2.7/site-packages/django/core/handlers/base.py", line 185, in 
_get_response
[Thu Jan 05 19:07:29.668695 2023] [:error] [pid 31]     response = 
wrapped_callback(request, *callback_args, **callback_kwargs)
[Thu Jan 05 19:07:29.668699 2023] [:error] [pid 31]   File 
"/usr/lib/python2.7/site-packages/horizon/decorators.py", line 52, in dec
[Thu Jan 05 19:07:29.668705 2023] [:error] [pid 31]     return 
view_func(request, *args, **kwargs)
[Thu Jan 05 19:07:29.668708 2023] [:error] [pid 31]   File 
"/usr/lib/python2.7/site-packages/horizon/decorators.py", line 36, in dec
[Thu Jan 05 19:07:29.668722 2023] [:error] [pid 31]     return 
view_func(request, *args, **kwargs)
[Thu Jan 05 19:07:29.668725 2023] [:error] [pid 31]   File 
"/usr/lib/python2.7/site-packages/horizon/decorators.py", line 36, in dec
[Thu Jan 05 19:07:29.668735 2023] [:error] [pid 31]     return 
view_func(request, *args, **kwargs)
[Thu Jan 05 19:07:29.668749 2023] [:error] [pid 31]   File 
"/usr/lib/python2.7/site-packages/horizon/decorators.py", line 113, in dec
[Thu Jan 05 19:07:29.668758 2023] [:error] [pid 31]     return 
view_func(request, *args, **kwargs)
[Thu Jan 05 19:07:29.668762 2023] [:error] [pid 31]   File 
"/usr/lib/python2.7/site-packages/horizon/decorators.py", line 84, in dec
[Thu Jan 05 19:07:29.668765 2023] [:error] [pid 31]     return 
view_func(request, *args, **kwargs)
[Thu Jan 05 19:07:29.668775 2023] [:error] [pid 31]   File 
"/usr/lib/python2.7/site-packages/django/views/generic/base.py", line 68, in 
view
[Thu Jan 05 19:07:29.668778 2023] [:error] [pid 31]     return 
self.dispatch(request, *args, **kwargs)
[Thu Jan 05 19:07:29.668785 2023] [:error] [pid 31]   File 
"/usr/lib/python2.7/site-packages/django/views/generic/base.py", line 88, in 
dispatch
[Thu Jan 05 19:07:29.668795 2023] [:error] [pid 31]     return handler(request, 
*args, **kwargs)
[Thu Jan 05 19:07:29.668799 2023] [:error] [pid 31]   File 
"/usr/lib/python2.7/site-packages/horizon/tables/views.py", line 223, in get
[Thu Jan 05 19:07:29.668802 2023] [:error] [pid 31]     handled = 
self.construct_tables()
[Thu Jan 05 19:07:29.668806 2023] [:error] [pid 31]   File 
"/usr/lib/python2.7/site-packages/horizon/tables/views.py", line 214, in 
construct_tables
[Thu Jan 05 19:07:29.668817 2023] [:error] [pid 31]     handled = 
self.handle_table(table)
[Thu Jan 05 19:07:29.668826 2023] [:error] [pid 31]   File 
"/usr/lib/python2.7/site-packages/horizon/tables/views.py", line 123, in 
handle_table
[Thu Jan 05 19:07:29.668830 2023] [:error] [pid 31]     data = 
self._get_data_dict()
[Thu Jan 05 19:07:29.668836 2023] [:error] [pid 31]   File 
"/usr/lib/python2.7/site-packages/horizon/tables/views.py", line 252, in 
_get_data_dict
[Thu Jan 05 19:07:29.668844 2023] [:error] [pid 31]     self._data = 
{self.table_class._meta.name: self.get_data()}
[Thu Jan 05 19:07:29.668848 2023] [:error] [pid 31]   File 
"/usr/share/openstack-dashboard/openstack_dashboard/dashboards/project/instances/views.py",
 line 163, in get_data
[Thu Jan 05 19:07:29.668854 2023] [:error] [pid 31]     if not 
process_non_api_filters(search_opts, non_api_filter_info):
[Thu Jan 05 19:07:29.668863 2023] [:error] [pid 31]   File 
"/usr/share/openstack-dashboard/openstack_dashboard/dashboards/project/instances/views.py",
 line 245, in process_non_api_filters
[Thu Jan 05 19:07:29.668867 2023] [:error] [pid 31]     if not 
_swap_filter(resources, search_opts, fake_field, real_field):
[Thu Jan 05 19:07:29.668872 2023] [:error] [pid 31]   File 
"/usr/share/openstack-dashboard/openstack_dashboard/dashboards/project/instances/views.py",
 line 255, in _swap_filter
[Thu Jan 05 19:07:29.668886 2023] [:error] [pid 31]     if 
resource.name.lower() == filter_string.lower()]
[Thu Jan 05 19:07:29.668896 2023] [:error] [pid 31] AttributeError: 'NoneType' 
object has no attribute 'lower'

** Affects: horizon
     Importance: Undecided
     Assignee: Stanislav Dmitriev (sdmitriev1)
         Status: In Progress

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

Title:
  Instances "Image Name" filter fails if image without a name exist

Status in OpenStack Dashboard (Horizon):
  In Progress

Bug description:
  Horizon breaks if "Instances page" "Image Name" filter is invoked and
  there is an image without name exists.

  How to reproduce:

  1. Create an image without a name
  image list --project 66ae0f36c4184e37b159ef3e9f39ea56 -c Name | more
  +-------------------------------------------+
  | Name                                      |
  +-------------------------------------------+
  | None                                      |
  | bionic-server                             |
  +-------------------------------------------+

  2. Go to Instances tab
  3. Put random value to "Image Name" field and press Filter

  
  Error trace:

  [Thu Jan 05 19:07:29.668641 2023] [:error] [pid 31] Traceback (most recent 
call last):
  [Thu Jan 05 19:07:29.668647 2023] [:error] [pid 31]   File 
"/usr/lib/python2.7/site-packages/django/core/handlers/exception.py", line 41, 
in inner
  [Thu Jan 05 19:07:29.668651 2023] [:error] [pid 31]     response = 
get_response(request)
  [Thu Jan 05 19:07:29.668656 2023] [:error] [pid 31]   File 
"/usr/lib/python2.7/site-packages/django/core/handlers/base.py", line 187, in 
_get_response
  [Thu Jan 05 19:07:29.668664 2023] [:error] [pid 31]     response = 
self.process_exception_by_middleware(e, request)
  [Thu Jan 05 19:07:29.668669 2023] [:error] [pid 31]   File 
"/usr/lib/python2.7/site-packages/django/core/handlers/base.py", line 185, in 
_get_response
  [Thu Jan 05 19:07:29.668695 2023] [:error] [pid 31]     response = 
wrapped_callback(request, *callback_args, **callback_kwargs)
  [Thu Jan 05 19:07:29.668699 2023] [:error] [pid 31]   File 
"/usr/lib/python2.7/site-packages/horizon/decorators.py", line 52, in dec
  [Thu Jan 05 19:07:29.668705 2023] [:error] [pid 31]     return 
view_func(request, *args, **kwargs)
  [Thu Jan 05 19:07:29.668708 2023] [:error] [pid 31]   File 
"/usr/lib/python2.7/site-packages/horizon/decorators.py", line 36, in dec
  [Thu Jan 05 19:07:29.668722 2023] [:error] [pid 31]     return 
view_func(request, *args, **kwargs)
  [Thu Jan 05 19:07:29.668725 2023] [:error] [pid 31]   File 
"/usr/lib/python2.7/site-packages/horizon/decorators.py", line 36, in dec
  [Thu Jan 05 19:07:29.668735 2023] [:error] [pid 31]     return 
view_func(request, *args, **kwargs)
  [Thu Jan 05 19:07:29.668749 2023] [:error] [pid 31]   File 
"/usr/lib/python2.7/site-packages/horizon/decorators.py", line 113, in dec
  [Thu Jan 05 19:07:29.668758 2023] [:error] [pid 31]     return 
view_func(request, *args, **kwargs)
  [Thu Jan 05 19:07:29.668762 2023] [:error] [pid 31]   File 
"/usr/lib/python2.7/site-packages/horizon/decorators.py", line 84, in dec
  [Thu Jan 05 19:07:29.668765 2023] [:error] [pid 31]     return 
view_func(request, *args, **kwargs)
  [Thu Jan 05 19:07:29.668775 2023] [:error] [pid 31]   File 
"/usr/lib/python2.7/site-packages/django/views/generic/base.py", line 68, in 
view
  [Thu Jan 05 19:07:29.668778 2023] [:error] [pid 31]     return 
self.dispatch(request, *args, **kwargs)
  [Thu Jan 05 19:07:29.668785 2023] [:error] [pid 31]   File 
"/usr/lib/python2.7/site-packages/django/views/generic/base.py", line 88, in 
dispatch
  [Thu Jan 05 19:07:29.668795 2023] [:error] [pid 31]     return 
handler(request, *args, **kwargs)
  [Thu Jan 05 19:07:29.668799 2023] [:error] [pid 31]   File 
"/usr/lib/python2.7/site-packages/horizon/tables/views.py", line 223, in get
  [Thu Jan 05 19:07:29.668802 2023] [:error] [pid 31]     handled = 
self.construct_tables()
  [Thu Jan 05 19:07:29.668806 2023] [:error] [pid 31]   File 
"/usr/lib/python2.7/site-packages/horizon/tables/views.py", line 214, in 
construct_tables
  [Thu Jan 05 19:07:29.668817 2023] [:error] [pid 31]     handled = 
self.handle_table(table)
  [Thu Jan 05 19:07:29.668826 2023] [:error] [pid 31]   File 
"/usr/lib/python2.7/site-packages/horizon/tables/views.py", line 123, in 
handle_table
  [Thu Jan 05 19:07:29.668830 2023] [:error] [pid 31]     data = 
self._get_data_dict()
  [Thu Jan 05 19:07:29.668836 2023] [:error] [pid 31]   File 
"/usr/lib/python2.7/site-packages/horizon/tables/views.py", line 252, in 
_get_data_dict
  [Thu Jan 05 19:07:29.668844 2023] [:error] [pid 31]     self._data = 
{self.table_class._meta.name: self.get_data()}
  [Thu Jan 05 19:07:29.668848 2023] [:error] [pid 31]   File 
"/usr/share/openstack-dashboard/openstack_dashboard/dashboards/project/instances/views.py",
 line 163, in get_data
  [Thu Jan 05 19:07:29.668854 2023] [:error] [pid 31]     if not 
process_non_api_filters(search_opts, non_api_filter_info):
  [Thu Jan 05 19:07:29.668863 2023] [:error] [pid 31]   File 
"/usr/share/openstack-dashboard/openstack_dashboard/dashboards/project/instances/views.py",
 line 245, in process_non_api_filters
  [Thu Jan 05 19:07:29.668867 2023] [:error] [pid 31]     if not 
_swap_filter(resources, search_opts, fake_field, real_field):
  [Thu Jan 05 19:07:29.668872 2023] [:error] [pid 31]   File 
"/usr/share/openstack-dashboard/openstack_dashboard/dashboards/project/instances/views.py",
 line 255, in _swap_filter
  [Thu Jan 05 19:07:29.668886 2023] [:error] [pid 31]     if 
resource.name.lower() == filter_string.lower()]
  [Thu Jan 05 19:07:29.668896 2023] [:error] [pid 31] AttributeError: 
'NoneType' object has no attribute 'lower'

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


-- 
Mailing list: https://launchpad.net/~yahoo-eng-team
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~yahoo-eng-team
More help   : https://help.launchpad.net/ListHelp

Reply via email to