Bug #9815
closedHostGroup Clone doesn't work if the hostgroup has parameters
Description
I ran into an issue trying to clone a HostGroup in Foreman 1.7.3. it goes to a 404 page. Here is a demo video: https://docs.google.com/a/lark-it.com/file/d/0Bw8r1SqN6Yt_TGVDa0YxQkFGY3c/edit?usp=drivesdk
It seems to only affect hostgroups that have parameters. I am able to clone hostgroups that do not have any parameters, even if they are nested several levels deep, with parent parameters.
Here is the difference between a "create" operation and a "clone" operation in logs:
- Create
{code}
Started POST "/hostgroups" for 67.176.44.123 at 2015-03-18 12:55:11 -0400
Processing by HostgroupsController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"(redacted)", "hostgroup"=>{"parent_id"=>"", "name"=>"CloneMe", "environment_id"=>"2", "compute_profile_id"=>"1", "puppet_ca_proxy_id"=>"1", "puppet_proxy_id"=>"1", "puppetclass_ids"=>[""], "domain_id"=>"2", "realm_id"=>"1", "architecture_id"=>"1", "operatingsystem_id"=>"1", "medium_id"=>"1", "ptable_id"=>"7", "root_pass"=>"[FILTERED]", "group_parameters_attributes"=>{"1426697695990"=>{"name"=>"MyParameter", "value"=>"[FILTERED]", "hidden_value"=>"[FILTERED]", "_destroy"=>"false", "nested"=>""}}, "organization_ids"=>[""], "id"=>""}, "commit"=>"Submit"}
Redirected to https://foreman.lark-it.com/hostgroups
Completed 302 Found in 174ms (ActiveRecord: 34.6ms) {code}
*Clone
{code}
Started POST "/hostgroups" for 67.176.44.123 at 2015-03-18 12:55:45 -0400
Processing by HostgroupsController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"(redacted)", "hostgroup"=>{"parent_id"=>"", "name"=>"ClonedGroup", "environment_id"=>"2", "compute_profile_id"=>"1", "puppet_ca_proxy_id"=>"1", "puppet_proxy_id"=>"1", "puppetclass_ids"=>[""], "domain_id"=>"2", "realm_id"=>"1", "architecture_id"=>"1", "operatingsystem_id"=>"1", "medium_id"=>"1", "ptable_id"=>"7", "root_pass"=>"[FILTERED]", "group_parameters_attributes"=>{"0"=>{"name"=>"MyParameter", "value"=>"[FILTERED]", "hidden_value"=>"[FILTERED]", "_destroy"=>"false", "nested"=>"", "id"=>"22"}}, "organization_ids"=>[""], "id"=>""}, "commit"=>"Submit"}
Rendered common/404.html.erb within layouts/application (3.3ms)
Rendered layouts/base.html.erb (3.4ms)
Completed 404 Not Found in 53ms (Views: 10.7ms | ActiveRecord: 5.6ms)
{code}
The difference appears to be:
{code}
"group_parameters_attributes"=>{"0"=>{"name"=>"MyParameter", "value"=>"[FILTERED]", "hidden_value"=>"[FILTERED]", "_destroy"=>"false", "nested"=>"", "id"=>"22"}}
{code}
Hope this helps ;)