Actions
Bug #3567
closedEditing an oVirt compute resource can throw errors loading quotes while loading page
Description
When editing an oVirt compute resource that's currently failing (e.g. bad admin password), the form won't load as it tries to get a list of quotas to display.
ActionView::Template::Error (401 Unauthorized): 9: :class => "btn + #{datacenters.empty? ? "" : "btn-success"}", 10: :'data-url' => test_connection_compute_resources_path) + image_tag('/assets/spinner.gif', :id => 'test_connection_indicator', :class => 'hide').html_safe }) %> 11: <% quotas = (f.object.uuid.nil? && controller.action_name != 'test_connection') ? [] : f.object.quotas rescue []%> 12: <%= select_f f, :ovirt_quota, quotas, :id, :name, {}, :label => _("Quota ID") %> app/helpers/layout_helper.rb:102:in `block in select_f' app/helpers/layout_helper.rb:130:in `block (2 levels) in field' app/helpers/layout_helper.rb:129:in `block in field' app/helpers/layout_helper.rb:124:in `field' app/helpers/layout_helper.rb:101:in `select_f' app/views/compute_resources/form/_ovirt.html.erb:12:in `_e7f9f939742f59e4e7d0512e1f936645' app/views/compute_resources/_form.html.erb:25:in `block in _d266af4e81ccfd6ac887a7d9ddb43142' app/helpers/layout_helper.rb:207:in `form_for' app/views/compute_resources/_form.html.erb:2:in `_d266af4e81ccfd6ac887a7d9ddb43142' app/views/compute_resources/edit.html.erb:3:in `_85d3215036b294085739cb8c859e0d6d' app/models/concerns/foreman/thread_session.rb:33:in `clear_thread'
It appears the f.object.quotas rescue []
doesn't work because the quotas are lazy-loaded, so it only fails when rendering the select box.
Actions