Bug #17170

NIC page does not reload when Bond is selected

Added by Lukas Zapletal 6 months ago. Updated 6 months ago.

Status:Closed
Priority:Normal
Assigned To:Dominic Cleal
Category:Host creation
Target version:-
Difficulty: Bugzilla link:
Found in release:1.13.1 Pull request:https://github.com/theforeman/foreman/pull/3994
Story points-
Velocity based estimate-
Release1.13.2Release relationshipAuto

Description

It is not possible to switch NIC type (e.g. to bond) on the Interfaces tab in 1.13 (and possibly develop).

 | ActiveModel::ForbiddenAttributesError: ActiveModel::ForbiddenAttributesError
 | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activemodel-4.2.5.1/lib/active_model/forbidden_attributes_protection.rb:21:in `sanitize_for_mass_assignment'
 | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/attribute_assignment.rb:33:in `assign_attributes'
 | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/core.rb:566:in `init_attributes'
 | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/core.rb:281:in `initialize'
 | /usr/share/foreman/app/models/host/base.rb:70:in `initialize'
 | /opt/rh/sclo-ror42/root/usr/share/gems/gems/actionpack-4.2.5.1/lib/action_dispatch/routing/url_for.rb:104:in `initialize'
 | /usr/share/foreman/app/models/host/managed.rb:49:in `initialize'
 | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/inheritance.rb:61:in `new'
 | /opt/rh/sclo-ror42/root/usr/share/gems/gems/activerecord-4.2.5.1/lib/active_record/inheritance.rb:61:in `new'
 | /usr/share/foreman/app/models/concerns/foreman/sti.rb:22:in `new_with_cast'

Screenshot 2016-11-07 14.10.47.png (157 KB) Preview Byron Miller, 11/07/2016 03:12 PM

Screenshot%202016-11-07%2014.10.47

Related issues

Related to Foreman - Feature #3917: Add strong_parameters to foreman Closed 12/19/2013

Associated revisions

Revision 93046b80
Added by Dominic Cleal 6 months ago

fixes #17170 - use strong params in InterfacesController

History

#1 Updated by Dominic Cleal 6 months ago

Can you show the request that's causing this in the logs? It should include the URL and parameter information, since it's the parameters that cause this exception (in development, anyway).

#2 Updated by Dominic Cleal 6 months ago

  • Release set to 1.13.2

Full request and parameters list, when creating a new host, edit the existing interface and select Bond from the menu:

2016-11-03T15:44:28 c50b235a [app] [I] Started GET "/interfaces/new?host%5Binterfaces_attributes%5D%5B0%5D%5B_destroy%5D=0&host%5Binterfaces_attributes%5D%5B0%5D%5Btype%5D=Nic%3A%3ABond&host%5Binterfaces_attributes%5D%5B0%5D%5Bmac%5D=&host%5Binterfaces_attributes%5D%5B0%5D%5Bidentifier%5D=&host%5Binterfaces_attributes%5D%5B0%5D%5Bname%5D=loren-ditmars&host%5Binterfaces_attributes%5D%5B0%5D%5Bdomain_id%5D=&host%5Binterfaces_attributes%5D%5B0%5D%5Bsubnet_id%5D=&host%5Binterfaces_attributes%5D%5B0%5D%5Bsubnet6_id%5D=&host%5Binterfaces_attributes%5D%5B0%5D%5Bip%5D=&host%5Binterfaces_attributes%5D%5B0%5D%5Bip6%5D=&host%5Binterfaces_attributes%5D%5B0%5D%5Bmanaged%5D=0&host%5Binterfaces_attributes%5D%5B0%5D%5Bmanaged%5D=1&host%5Binterfaces_attributes%5D%5B0%5D%5Bprimary%5D=0&host%5Binterfaces_attributes%5D%5B0%5D%5Bprimary%5D=1&host%5Binterfaces_attributes%5D%5B0%5D%5Bprovision%5D=0&host%5Binterfaces_attributes%5D%5B0%5D%5Bprovision%5D=1&host%5Binterfaces_attributes%5D%5B0%5D%5Bvirtual%5D=0&host%5Binterfaces_attributes%5D%5B0%5D%5Btag%5D=&host%5Binterfaces_attributes%5D%5B0%5D%5Battached_to%5D=&host%5Bcompute_resource_id%5D=&_=1478187861319" for 127.0.0.1 at 2016-11-03 15:44:28 +0000
2016-11-03T15:44:28 c50b235a [app] [I] Processing by InterfacesController#new as JS
2016-11-03T15:44:28 c50b235a [app] [I]   Parameters: {"host"=>{"interfaces_attributes"=>{"0"=>{"_destroy"=>"0", "type"=>"Nic::Bond", "mac"=>"", "identifier"=>"", "name"=>"loren-ditmars", "domain_id"=>"", "subnet_id"=>"", "subnet6_id"=>"", "ip"=>"", "ip6"=>"", "managed"=>"1", "primary"=>"1", "provision"=>"1", "virtual"=>"0", "tag"=>"", "attached_to"=>""}}, "compute_resource_id"=>""}, "_"=>"1478187861319"}
2016-11-03T15:44:28 c50b235a [sql] [D]   ActiveRecord::SessionStore::Session Load (0.2ms)  SELECT  "sessions".* FROM "sessions" WHERE "sessions"."session_id" = ?  ORDER BY "sessions"."id" ASC LIMIT 1  [["session_id", "c50b235a48cb1e68cb9f3ecdf05f0a1e"]]
2016-11-03T15:44:28 c50b235a [sql] [D]   User Load (0.1ms)  SELECT  "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1  [["id", 24]]
2016-11-03T15:44:28 c50b235a [app] [D] Setting current user thread-local variable to admin
2016-11-03T15:44:28 c50b235a [sql] [D]   AuthSource Load (0.1ms)  SELECT  "auth_sources".* FROM "auth_sources" WHERE "auth_sources"."id" = ? LIMIT 1  [["id", 1]]
2016-11-03T15:44:28 c50b235a [app] [I] Completed 500 Internal Server Error in 9ms (ActiveRecord: 0.4ms)
2016-11-03T15:44:28 c50b235a [app] [F] 
 | ActiveModel::ForbiddenAttributesError (ActiveModel::ForbiddenAttributesError):
 |   app/models/host/base.rb:76:in `initialize'
 |   app/models/host/managed.rb:48:in `initialize'
 |   app/models/concerns/foreman/sti.rb:22:in `new_with_cast'
 |   app/models/host.rb:15:in `method_missing'
 |   app/controllers/interfaces_controller.rb:8:in `new'
 |   app/controllers/concerns/application_shared.rb:14:in `set_timezone'
 |   app/models/concerns/foreman/thread_session.rb:32:in `clear_thread'
 |   lib/middleware/catch_json_parse_errors.rb:8:in `call'
 |   lib/middleware/tagged_logging.rb:18:in `call'
 | 
 | 
2016-11-03T15:44:28 c50b235a [app] [I]   Rendered /home/dcleal/.rvm/gems/ruby-2.3.0@foreman/gems/actionpack-4.2.7.1/lib/action_dispatch/middleware/templates/rescues/_source.erb (2.4ms)

It appears that the InterfacesController doesn't use strong params.

#3 Updated by Dominic Cleal 6 months ago

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

#4 Updated by Dominic Cleal 6 months ago

  • Status changed from New to Assigned
  • Assigned To set to Dominic Cleal

#5 Updated by The Foreman Bot 6 months ago

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

#6 Updated by Dominic Cleal 6 months ago

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

#7 Updated by Byron Miller 6 months ago

I applied the attached change to my instance of foreman. When i edit a host i can see the form, however during discovery of a host the bond menu doesn't drop down when provisioning.

I also noticed if i edit the attached interfaces and click save, they just disappear and they're not saved.

#8 Updated by Byron Miller 6 months ago

Here i've edited the interface and i'm about to click save. I can see the interfaces listed.

But after saving i see no interfaces saved

#9 Updated by Byron Miller 6 months ago

Byron Miller wrote:

Here i've edited the interface and i'm about to click save. I can see the interfaces listed.

https://www.dropbox.com/s/y12a6i5auaikah6/Screenshot%202016-11-05%2014.40.54.png?dl=0

But after saving i see no interfaces saved

https://www.dropbox.com/s/2mclx0qli0s3uwp/Screenshot%202016-11-05%2014.41.23.png?dl=0

#10 Updated by Byron Miller 6 months ago

Here is a screenshot of the bond form coming in through discovery.

https://www.dropbox.com/s/cwb0cra28b4dwck/Screenshot%202016-11-07%2014.10.47.png?dl=0

#11 Updated by Dominic Cleal 6 months ago

If the bug occurs on the New Host form, please file a new bug against Foreman. If it only happens during Discovery, please file the issue against Foreman Discovery.

Also available in: Atom PDF