Actions
Bug #18630
closedCannot change from synced to non-synced OS
Description
On the Host page I see a problem where:
1st - I choose a hostgroup with an OS that is synced as a product (RHEL)
2nd - I decide to choose a different OS (not synced, one from the Foreman OS list)
3rd - This doesn't seem to work and on the logs I see:
| ActiveModel::ForbiddenAttributesError - ActiveModel::ForbiddenAttributesError: | activemodel (4.2.7.1) lib/active_model/forbidden_attributes_protection.rb:21:in `sanitize_for_mass_assignment' | activerecord (4.2.7.1) lib/active_record/attribute_assignment.rb:33:in `assign_attributes' | activerecord (4.2.7.1) lib/active_record/core.rb:566:in `init_attributes' | activerecord (4.2.7.1) lib/active_record/core.rb:281:in `initialize' | activerecord (4.2.7.1) lib/active_record/inheritance.rb:61:in `new' | activerecord (4.2.7.1) lib/active_record/inheritance.rb:61:in `new' | activerecord (4.2.7.1) lib/active_record/reflection.rb:141:in `build_association' | activerecord (4.2.7.1) lib/active_record/associations/association.rb:250:in `build_record' | activerecord (4.2.7.1) lib/active_record/associations/singular_association.rb:29:in `build' | activerecord (4.2.7.1) lib/active_record/associations/builder/singular_association.rb:18:in `build_content_facet' | activerecord (4.2.7.1) lib/active_record/nested_attributes.rb:398:in `assign_nested_attributes_for_one_to_one_association' | activerecord (4.2.7.1) lib/active_record/nested_attributes.rb:343:in `content_facet_attributes=' | activerecord (4.2.7.1) lib/active_record/attribute_assignment.rb:54:in `public_send' | activerecord (4.2.7.1) lib/active_record/attribute_assignment.rb:54:in `_assign_attribute' | activerecord (4.2.7.1) lib/active_record/attribute_assignment.rb:65:in `block in assign_nested_parameter_attributes' | activerecord (4.2.7.1) lib/active_record/attribute_assignment.rb:65:in `each' | activerecord (4.2.7.1) lib/active_record/attribute_assignment.rb:65:in `assign_nested_parameter_attributes' | activerecord (4.2.7.1) lib/active_record/attribute_assignment.rb:45:in `assign_attributes' | activerecord (4.2.7.1) lib/active_record/core.rb:566:in `init_attributes' | activerecord (4.2.7.1) lib/active_record/core.rb:281:in `initialize' | app/models/host/base.rb:76:in `initialize' | actionpack (4.2.7.1) lib/action_dispatch/routing/url_for.rb:104:in `initialize' | app/models/host/managed.rb:49:in `initialize' | activerecord (4.2.7.1) lib/active_record/inheritance.rb:61:in `new' | activerecord (4.2.7.1) lib/active_record/inheritance.rb:61:in `new' | app/models/concerns/foreman/sti.rb:22:in `new_with_cast' | app/models/host.rb:15:in `method_missing' | app/controllers/concerns/foreman/controller/host_details.rb:50:in `block in assign_parameter' | app/models/taxonomy.rb:71:in `block (2 levels) in as_taxonomy' | app/models/concerns/foreman/thread_session.rb:147:in `as_location' | app/models/taxonomy.rb:70:in `block in as_taxonomy' | app/models/concerns/foreman/thread_session.rb:112:in `as_org' | app/models/taxonomy.rb:69:in `as_taxonomy' | app/controllers/concerns/foreman/controller/host_details.rb:49:in `assign_parameter' | app/controllers/concerns/foreman/controller/host_details.rb:12:in `o
After inspecting the parameters being sent using pry, I noticed something interesting, if I took the ActiveController::Parameters object and try to do Host.new(host_params), it would not work. If I tried to create a host manually with Host.new(manuallyinputtedparams) it worked. These are the params in question, they just don't seem to be filtered through host_params.
{"architecture_id"=>"1", "hostgroup_id"=>"4", "location_id"=>"2", "medium_id"=>"", "operatingsystem_id"=>"8", "organization_id"=>"4", "type"=>"Host::Managed", "puppet_proxy_id"=>1, "puppet_ca_proxy_id"=>1, "environment_id"=>1, "compute_profile_id"=>nil, "realm_id"=>nil, "content_facet_attributes"=> {"kickstart_repository_id"=>28, "content_view_id"=>4, "lifecycle_environment_id"=>5, "content_source_id"=>1}}
Actions