Bug #17170
closedNIC page does not reload when Bond is selected
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'
Files
Updated by Dominic Cleal about 8 years 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).
Updated by Dominic Cleal about 8 years ago
- Translation missing: en.field_release set to 203
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.
Updated by Dominic Cleal about 8 years ago
- Related to Feature #3917: Add strong_parameters to foreman added
Updated by Dominic Cleal about 8 years ago
- Status changed from New to Assigned
- Assignee set to Dominic Cleal
Updated by The Foreman Bot about 8 years ago
- Status changed from Assigned to Ready For Testing
- Pull request https://github.com/theforeman/foreman/pull/3994 added
Updated by Dominic Cleal about 8 years ago
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Applied in changeset 93046b80ad54cfaecf37d14f701dda8613265b1a.
Updated by Byron Miller about 8 years 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.
Updated by Byron Miller about 8 years 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
Updated by Byron Miller about 8 years 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
Updated by Byron Miller about 8 years 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
Updated by Dominic Cleal about 8 years 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.