Project

General

Profile

Actions

Bug #33049

closed

Make name_column helper defensive with displaying statuses

Added by Tomer Brisker over 3 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Inventory
Target version:
-
Difficulty:
Triaged:
No
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.

Actions

Also available in: Atom PDF