Project

General

Profile

Bug #33049

Make name_column helper defensive with displaying statuses

Added by Tomer Brisker 2 months ago. Updated about 2 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Inventory
Target version:
-
Difficulty:
Triaged:
No
Bugzilla link:
Fixed in Releases:
Found in Releases:

Description

While this shouldn't occur, if for some reason a host status has no type column the name_column helper will cause the page to fail loading with

 
Backtrace for 'comparison of String with nil failed' error (ActionView::Template::Error): comparison of String with nil failed
 | /usr/share/foreman/app/helpers/hosts_helper.rb:97:in `sort_by'
 | /usr/share/foreman/app/helpers/hosts_helper.rb:97:in `name_column'
...

We can avoid this failure easily by being more defensive in our code.

Associated revisions

Revision 29aceca8 (diff)
Added by Tomer Brisker 2 months ago

Fixes #33049 - Properly handle missing status type (#8675)

While this shouldn't occur, it appears in some edge cases a status might
be created with no type property. In that case we should not display the
status and not try to sort on it.

History

#1 Updated by The Foreman Bot 2 months ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/8675 added

#2 Updated by The Foreman Bot 2 months ago

  • Fixed in Releases 3.0.0 added

#3 Updated by Tomer Brisker 2 months ago

  • Status changed from Ready For Testing to Closed

#4 Updated by Tomer Brisker about 2 months ago

  • Fixed in Releases 2.5.3 added

Also available in: Atom PDF