Bug #973
closedError 500 when click "All Puppet Classes"
Description
I receive error 500 page when clicking the "All Puppet Classes" button in foreman on a host page. From production.log:
Processing HostsController#storeconfig_klasses (for ###.###.###.### at
2011-06-08 15:57:20) [GET]
Parameters: {"action"=>"storeconfig_klasses",
"id"=>"hostname.usps.gov", "controller"=>"hosts"}
Rendering template within layouts/application
Rendering hosts/storeconfig_klasses
ActionView::TemplateError (Couldn't find Puppet::Rails::Resource
without an ID) on line #3 of app/views/hosts/
storeconfig_klasses.html.erb:
1: <% title "All Puppet Classes for #{@host}" >
2: <ul>
3: < for klass in @host.classes_from_storeconfigs ->
4: <li><= h klass ></li>
5: < end -%>
6: </ul>
app/models/host.rb:480:in `classes_from_storeconfigs'
app/views/hosts/storeconfig_klasses.html.erb:3
passenger (3.0.2) lib/phusion_passenger/rack/request_handler.rb:
96:in `process_request'
passenger (3.0.2) lib/phusion_passenger/
abstract_request_handler.rb:513:in `accept_and_process_next_request'
passenger (3.0.2) lib/phusion_passenger/
abstract_request_handler.rb:274:in `main_loop'
passenger (3.0.2) lib/phusion_passenger/classic_rails/
application_spawner.rb:321:in `start_request_handler'
passenger (3.0.2) lib/phusion_passenger/classic_rails/
application_spawner.rb:275:in `send'
passenger (3.0.2) lib/phusion_passenger/classic_rails/
application_spawner.rb:275:in `handle_spawn_application'
passenger (3.0.2) lib/phusion_passenger/utils.rb:479:in
`safe_fork'
passenger (3.0.2) lib/phusion_passenger/classic_rails/
application_spawner.rb:270:in `handle_spawn_application'
passenger (3.0.2) lib/phusion_passenger/abstract_server.rb:357:in
`__send__'
passenger (3.0.2) lib/phusion_passenger/abstract_server.rb:357:in
`server_main_loop'
passenger (3.0.2) lib/phusion_passenger/abstract_server.rb:206:in
`start_synchronously'
passenger (3.0.2) lib/phusion_passenger/abstract_server.rb:180:in
`start'
passenger (3.0.2) lib/phusion_passenger/classic_rails/
application_spawner.rb:149:in `start'
passenger (3.0.2) lib/phusion_passenger/spawn_manager.rb:219:in
`spawn_rails_application'
passenger (3.0.2) lib/phusion_passenger/
abstract_server_collection.rb:132:in `lookup_or_add'
passenger (3.0.2) lib/phusion_passenger/spawn_manager.rb:214:in
`spawn_rails_application'
passenger (3.0.2) lib/phusion_passenger/
abstract_server_collection.rb:82:in `synchronize'
passenger (3.0.2) lib/phusion_passenger/
abstract_server_collection.rb:79:in `synchronize'
passenger (3.0.2) lib/phusion_passenger/spawn_manager.rb:213:in
`spawn_rails_application'
passenger (3.0.2) lib/phusion_passenger/spawn_manager.rb:132:in
`spawn_application'
passenger (3.0.2) lib/phusion_passenger/spawn_manager.rb:275:in
`handle_spawn_application'
passenger (3.0.2) lib/phusion_passenger/abstract_server.rb:357:in
`__send__'
passenger (3.0.2) lib/phusion_passenger/abstract_server.rb:357:in
`server_main_loop'
passenger (3.0.2) lib/phusion_passenger/abstract_server.rb:206:in
`start_synchronously'
passenger (3.0.2) helper-scripts/passenger-spawn-server:99
Rendering /srv/www/usps-puppet-foreman/public/500.html (500 Internal
Server Error)
This is with foreman 0.3.
Fixed from diff:
diff --git a/app/models/host.rb b/app/models/host.rb
index ac32a75..6e089b0 100644
--- a/app/models/host.rb
++ b/app/models/host.rb @ -477,7 +477,7
@ class Host < Puppet::Rails::Host
end
def classes_from_storeconfigs
- klasses = resources.find.all(:conditions => {:restype => "Class"},
:select => :title, :order => :title)
klasses = resources.all(:conditions => {:restype => "Class"}, :select
=> :title, :order => :title)
klasses.map!(&:title).delete(:main)
return klasses
http://groups.google.com/group/foreman-users/browse_thread/thread/f9e076d19a9260f1