Project

General

Profile

Bug #16025

Import subnets from proxy returns 500

Added by Daniel Lobato Garcia almost 4 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Normal
Category:
Importers
Target version:
Difficulty:
Triaged:
Bugzilla link:
Fixed in Releases:
Found in Releases:

Description

Currently trying to import IPv4 subnets is broken, as the view calls `.to_s` which in turn calls `.name` on subnets that are not yet created.
We should not call `.to_s` and just use the `.network_address` representation which is always available at that stage when importing subnets.


Related issues

Related to Foreman - Bug #5785: Override class parameter by subnet no longer works since 1.5Closed2014-05-19
Related to Foreman - Feature #3917: Add strong_parameters to foremanClosed2013-12-19

Associated revisions

Revision 4622318f (diff)
Added by Daniel Lobato Garcia almost 4 years ago

Fixes #16025 - Fix ERB & params to import subnets from proxy

Before this commit, the ERB would just throw a 500 because it tried to
show @subnet.name in a template for a @subnet that was still undefined.

Aside from that, the create_multiple method in the controller didn't
send the right call to filter the params, hence making it impossible to
create the imported subnets even with the ERB fix.

History

#1 Updated by Dominic Cleal almost 4 years ago

  • Related to Bug #5785: Override class parameter by subnet no longer works since 1.5 added

#2 Updated by Dominic Cleal almost 4 years ago

  • Status changed from New to Assigned
  • Legacy Backlogs Release (now unused) set to 160

#3 Updated by Daniel Lobato Garcia almost 4 years ago

  • Status changed from Assigned to New
  • Legacy Backlogs Release (now unused) deleted (160)

There seem to be some problems submitting the form as well due to strong_params, I'll fix that in this ticket too

#4 Updated by Dominic Cleal almost 4 years ago

  • Status changed from New to Assigned
  • Legacy Backlogs Release (now unused) set to 160

#5 Updated by The Foreman Bot almost 4 years ago

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

#6 Updated by Daniel Lobato Garcia almost 4 years ago

  • Target version set to 1.7.1

#7 Updated by Daniel Lobato Garcia almost 4 years ago

  • Target version changed from 1.7.1 to 1.6.2

#8 Updated by Dominic Cleal almost 4 years ago

14:51:20 rails.1   |  | ActionView::Template::Error (undefined method `gsub' for nil:NilClass):
14:51:20 rails.1   |  |      6:   <% display_all = !minimal?(@subnets) %>
14:51:20 rails.1   |  |      7:   <div class="accordion" id='accordion1'>
14:51:20 rails.1   |  |      8:   <% @subnets.each do |subnet| %>
14:51:20 rails.1   |  |      9:     <% id = 'subnet_fields_'+subnet.to_s.gsub('/','_').gsub('.','_') %>
14:51:20 rails.1   |  |     10:     <div class="accordion-group">
14:51:20 rails.1   |  |     11:       <div class="accordion-heading" >
14:51:20 rails.1   |  |     12:         <a class="accordion-toggle" data-toggle="collapse" data-parent='#accordion1' href="<%= '#'+id %>" data-original-title='review' rel='twipsy' > <%= subnet %> </a>
14:51:20 rails.1   |  |   app/views/subnets/import.html.erb:9:in `block (2 levels) in _app_views_subnets_import_html_erb__4256384505841870065_70124028260720'
14:51:20 rails.1   |  |   app/views/subnets/import.html.erb:8:in `each'
14:51:20 rails.1   |  |   app/views/subnets/import.html.erb:8:in `block in _app_views_subnets_import_html_erb__4256384505841870065_70124028260720'
14:51:20 rails.1   |  |   app/helpers/form_helper.rb:257:in `form_for'
14:51:20 rails.1   |  |   app/views/subnets/import.html.erb:5:in `_app_views_subnets_import_html_erb__4256384505841870065_70124028260720'
14:51:20 rails.1   |  |   app/controllers/concerns/application_shared.rb:14:in `set_timezone'
14:51:20 rails.1   |  |   app/models/concerns/foreman/thread_session.rb:32:in `clear_thread'
14:51:20 rails.1   |  |   lib/middleware/catch_json_parse_errors.rb:9:in `call'
14:51:20 rails.1   |  |   lib/middleware/tagged_logging.rb:18:in `call'

#9 Updated by Dominic Cleal almost 4 years ago

  • Related to Feature #3917: Add strong_parameters to foreman added

#10 Updated by Daniel Lobato Garcia almost 4 years ago

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

Also available in: Atom PDF