Project

General

Profile

Bug #916

Incorrect fact entries in the db breaks facts view

Added by Kal McFate over 9 years ago. Updated over 9 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Web Interface
Target version:
Difficulty:
Triaged:
No
Bugzilla link:
Pull request:
Fixed in Releases:
Found in Releases:

Description

Processing FactValuesController#index (for 172.16.105.50 at 2011-05-19 13:10:11) [GET]
Parameters: {"action"=>"index", "controller"=>"fact_values"}
Rendering template within layouts/application
Rendering fact_values/index

ActionView::TemplateError (host_facts_url failed to generate from {:host_id=>nil, :action=>"index", :controller=>"fact_values"}, expected: {:action=>"index", :controller=>"fact_values"}, diff: {:host_id=>nil}) on line #18 of app/views/fa
ct_values/index.html.erb:
15: <% unless params[:host_id] ->
16: <td>
17: <%= link_to(h(fact_value.host.nil? ? "N/A" : fact_value.host),
18: host_facts_path(:host_id => fact_value.host),
19: :title => "Show host") %></td>
20: <
end %>
21: <td>

(eval):17:in `host_facts_path'
app/views/fact_values/index.html.erb:18
app/views/fact_values/index.html.erb:12:in `each'
app/views/fact_values/index.html.erb:12
passenger (2.2.11) lib/phusion_passenger/rack/request_handler.rb:92:in `process_request'
passenger (2.2.11) lib/phusion_passenger/abstract_request_handler.rb:207:in `main_loop'
passenger (2.2.11) lib/phusion_passenger/railz/application_spawner.rb:418:in `start_request_handler'
passenger (2.2.11) lib/phusion_passenger/railz/application_spawner.rb:358:in `handle_spawn_application'
passenger (2.2.11) lib/phusion_passenger/utils.rb:184:in `safe_fork'
passenger (2.2.11) lib/phusion_passenger/railz/application_spawner.rb:354:in `handle_spawn_application'
passenger (2.2.11) lib/phusion_passenger/abstract_server.rb:352:in `__send__'
passenger (2.2.11) lib/phusion_passenger/abstract_server.rb:352:in `main_loop'
passenger (2.2.11) lib/phusion_passenger/abstract_server.rb:196:in `start_synchronously'
passenger (2.2.11) lib/phusion_passenger/abstract_server.rb:163:in `start'
passenger (2.2.11) lib/phusion_passenger/railz/application_spawner.rb:213:in `start'
passenger (2.2.11) lib/phusion_passenger/spawn_manager.rb:262:in `spawn_rails_application'
passenger (2.2.11) lib/phusion_passenger/abstract_server_collection.rb:126:in `lookup_or_add'
passenger (2.2.11) lib/phusion_passenger/spawn_manager.rb:256:in `spawn_rails_application'
passenger (2.2.11) lib/phusion_passenger/abstract_server_collection.rb:80:in `synchronize'
passenger (2.2.11) lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
passenger (2.2.11) lib/phusion_passenger/spawn_manager.rb:255:in `spawn_rails_application'
passenger (2.2.11) lib/phusion_passenger/spawn_manager.rb:154:in `spawn_application'
passenger (2.2.11) lib/phusion_passenger/spawn_manager.rb:287:in `handle_spawn_application'
passenger (2.2.11) lib/phusion_passenger/abstract_server.rb:352:in `__send__'
passenger (2.2.11) lib/phusion_passenger/abstract_server.rb:352:in `main_loop'
passenger (2.2.11) lib/phusion_passenger/abstract_server.rb:196:in `start_synchronously'

Rendering /usr/share/foreman/public/500.html (500 Internal Server Error)

Associated revisions

Revision 8d83fc22 (diff)
Added by Ohad Levy over 9 years ago

fixes #916 - Incorrect fact entries in the db breaks facts view

History

#1 Updated by Ohad Levy over 9 years ago

from where did you reach that link? (just by pressing the facts tab?)

it looks like, you have a fact without a host in your database... (are you using storeconfigs?) did you some how removed host entries without removing the related fact values?

#2 Updated by Kal McFate over 9 years ago

This is just from clicking the facts tab. It is entirely possible I have facts w/o associated hosts. However 0.2 did not throw an error. I will examine the database.

Thanks

#3 Updated by Ohad Levy over 9 years ago

can you try this quick solution?

diff --git a/app/views/fact_values/index.html.erb b/app/views/fact_values/index.html.erb
index a1cc0c5..5dd77a5 100644
--- a/app/views/fact_values/index.html.erb
+++ b/app/views/fact_values/index.html.erb
@@ -14,9 +14,12 @@
     <tr class="<%= cycle("even", "odd") -%>">
       <% unless params[:host_id] -%>
         <td>
-          <%= link_to(h(fact_value.host.nil? ? "N/A" : fact_value.host),
-                      host_facts_path(:host_id => fact_value.host),
-          :title => "Show host") %></td>
+          <% if fact_value.host -%>
+            <%= link_to(fact_value.host, host_facts_path(:host_id => fact_value.host), :title => "Show host") %>
+          <% else -%>
+            N/A
+          <% end %>
+        </td>
       <% end %>
       <td>
         <%= link_to h(fact_value.fact_name.name),

#4 Updated by Kal McFate over 9 years ago

That works.

#5 Updated by Ohad Levy over 9 years ago

  • Target version set to 0.3

#6 Updated by Ohad Levy over 9 years ago

  • Subject changed from Can not view 'facts' tab in 0.3rc1 to Incorrect fact entries in the db breaks facts view

#7 Updated by Ohad Levy over 9 years ago

  • Status changed from New to Ready For Testing
  • % Done changed from 0 to 100

#8 Updated by Ohad Levy over 9 years ago

  • Category set to Web Interface
  • Status changed from Ready For Testing to Closed
  • Assignee set to Ohad Levy

Also available in: Atom PDF