Description of problem: When viewing the summary screen of a VM for a VMware Provider, the UI crashes with a FATAL error, "Unexpected error encountered (comparison of NilClass with String failed [vm_infra/explorer])". Stack trace here [1], line of code where issue is spotted [2]. After reviewing the code, and analyzing the custom_attributes table, there were entries with a NULL value for the 'name' column. Selecting VMs that had the 'name' column as NULL gave the error in the UI. After changing the value of the column 'name' to a valid string, the error was not seen in the UI. [1] [----] I, [2018-01-15T13:17:26.765714 #1586:16701a0] INFO -- : Rendered /opt/rh/cfme-gemset/bundler/gems/manageiq-ui-classic-35beb5e894ab/app/views/vm_infra/explorer.html.haml within layouts/application (356.1ms) [----] F, [2018-01-15T13:17:26.766241 #1586:16701a0] FATAL -- : Error caught: [ActionView::Template::Error] comparison of NilClass with String failed /opt/rh/cfme-gemset/bundler/gems/manageiq-ui-classic-35beb5e894ab/app/helpers/vm_helper/textual_summary.rb:760:in `sort_by' /opt/rh/cfme-gemset/bundler/gems/manageiq-ui-classic-35beb5e894ab/app/helpers/vm_helper/textual_summary.rb:760:in `textual_ems_custom_attributes' /opt/rh/cfme-gemset/bundler/gems/manageiq-ui-classic-35beb5e894ab/app/helpers/vm_helper/textual_summary.rb:104:in `textual_group_ems_custom_attributes' /opt/rh/cfme-gemset/bundler/gems/manageiq-ui-classic-35beb5e894ab/app/helpers/textual_summary_helper.rb:43:in `textual_group_render_options' /opt/rh/cfme-gemset/bundler/gems/manageiq-ui-classic-35beb5e894ab/app/views/layouts/_textual_groups_raw.html.haml:5:in `block (2 levels) in __opt_rh_cfme_gemset_bundler_gems_manageiq_ui_classic___beb_e___ab_app_views_layouts__textual_groups_raw_html_haml___1814887988728739052_199750560' /opt/rh/cfme-gemset/bundler/gems/manageiq-ui-classic-35beb5e894ab/app/views/layouts/_textual_groups_raw.html.haml:4:in `each' /opt/rh/cfme-gemset/bundler/gems/manageiq-ui-classic-35beb5e894ab/app/views/layouts/_textual_groups_raw.html.haml:4:in `block in __opt_rh_cfme_gemset_bundler_gems_manageiq_ui_classic___beb_e___ab_app_views_layouts__textual_groups_raw_html_haml___1814887988728739052_199750560' /opt/rh/cfme-gemset/bundler/gems/manageiq-ui-classic-35beb5e894ab/app/views/layouts/_textual_groups_raw.html.haml:2:in `each' /opt/rh/cfme-gemset/bundler/gems/manageiq-ui-classic-35beb5e894ab/app/views/layouts/_textual_groups_raw.html.haml:2:in `__opt_rh_cfme_gemset_bundler_gems_manageiq_ui_classic___beb_e___ab_app_views_layouts__textual_groups_raw_html_haml___1814887988728739052_199750560' /opt/rh/cfme-gemset/gems/actionview-5.0.3/lib/action_view/template.rb:159:in `block in render' /opt/rh/cfme-gemset/gems/activesupport-5.0.3/lib/active_support/notifications.rb:166:in `instrument' /opt/rh/cfme-gemset/gems/actionview-5.0.3/lib/action_view/template.rb:354:in `instrument' /opt/rh/cfme-gemset/gems/actionview-5.0.3/lib/action_view/template.rb:157:in `render' /opt/rh/cfme-gemset/gems/actionview-5.0.3/lib/action_view/renderer/partial_renderer.rb:343:in `render_partial' /opt/rh/cfme-gemset/gems/actionview-5.0.3/lib/action_view/renderer/partial_renderer.rb:311:in `block in render' /opt/rh/cfme-gemset/gems/actionview-5.0.3/lib/action_view/renderer/abstract_renderer.rb:42:in `block in instrument' /opt/rh/cfme-gemset/gems/activesupport-5.0.3/lib/active_support/notifications.rb:164:in `block in instrument' /opt/rh/cfme-gemset/gems/activesupport-5.0.3/lib/active_support/notifications/instrumenter.rb:21:in `instrument' /opt/rh/cfme-gemset/gems/activesupport-5.0.3/lib/active_support/notifications.rb:164:in `instrument' /opt/rh/cfme-gemset/gems/actionview-5.0.3/lib/action_view/renderer/abstract_renderer.rb:41:in `instrument' /opt/rh/cfme-gemset/gems/actionview-5.0.3/lib/action_view/renderer/partial_renderer.rb:310:in `render' /opt/rh/cfme-gemset/gems/actionview-5.0.3/lib/action_view/renderer/renderer.rb:47:in `render_partial' /opt/rh/cfme-gemset/gems/actionview-5.0.3/lib/action_view/renderer/renderer.rb:21:in `render' /opt/rh/cfme-gemset/gems/actionview-5.0.3/lib/action_view/helpers/rendering_helper.rb:32:in `render' /opt/rh/cfme-gemset/bundler/gems/manageiq-ui-classic-35beb5e894ab/app/views/layouts/_textual_groups_generic.html.haml:2:in `__opt_rh_cfme_gemset_bundler_gems_manageiq_ui_classic___beb_e___ab_app_views_layouts__textual_groups_generic_html_haml___462897049736687086_127870980' [2] /opt/rh/cfme-gemset/bundler/gems/manageiq-ui-classic-35beb5e894ab/app/helpers/vm_helper/textual_summary.rb 756 def textual_ems_custom_attributes 758 attrs = @record.ems_custom_attributes 759 return nil if attrs.blank? 760 attrs.sort_by(&:name).collect { |a| {:label => a.name, :value => a.value} } 761 end Version-Release number of selected component (if applicable): CFME 5.8.2.3 How reproducible: always Steps to Reproduce: 1. Have a custome attribute for a VM with a NULL value for the 'name' column 2. Try to view the summary screen for the VM in the Web UI 3. Actual results: Error reported in the UI Expected results: Summary screen should still display when custom attribute name value is NULL Additional info:
I'd say that the backend should not allow a null value for the name. It makes no sense. However to fix the situation for the customer I am going to handle the null value on the UI side.
https://github.com/ManageIQ/manageiq-ui-classic/pull/3268
https://github.com/ManageIQ/manageiq-ui-classic/pull/3272
New commit detected on ManageIQ/manageiq-ui-classic/master: https://github.com/ManageIQ/manageiq-ui-classic/commit/92d158ae42f676cd39d0303166662f848d3c7852 commit 92d158ae42f676cd39d0303166662f848d3c7852 Author: Martin Povolny <mpovolny> AuthorDate: Thu Jan 18 11:58:26 2018 +0100 Commit: Martin Povolny <mpovolny> CommitDate: Thu Jan 18 15:12:57 2018 +0100 Vm display: don't crash on custom attributes with null name. Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1535192 app/helpers/host_helper/textual_summary.rb | 2 +- app/helpers/textual_mixins/vm_common.rb | 2 +- spec/controllers/vm_infra_controller_spec.rb | 36 ++++++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 2 deletions(-)