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 ;)
Updated by Tommy McNeely almost 10 years ago
Sorry, my formatting above sucked, been using JIRA too much :)
The key difference is the `"id"=>"22"` in the `group_parameters_attributes` section.
Updated by Tommy McNeely almost 10 years ago
This may be as simple as changing "param.clone" to "param.dup"
Updated by Tommy McNeely almost 10 years ago
Confirmed in "develop" (1.8) .. and in debug mode, it also confirms that its crapping out on the group_parameter.
2015-03-18 11:56:46 [I] Started POST "/hostgroups" for 10.250.251.1 at 2015-03-18 11:56:46 -0600 2015-03-18 11:56:46 [I] Processing by HostgroupsController#create as HTML 2015-03-18 11:56:46 [I] Parameters: {"utf8"=>"✓", "authenticity_token"=>"Y5APgFaxM+tTlwuDK7Dk7J9c4PG1EThzagazKfMX8V0=", "hostgroup"=>{"parent_id"=>"", "name"=>"Cloned", "environment_id"=>"1", "compute_profile_id"=>"1", "puppetclass_ids"=>[""], "domain_id"=>"1", "realm_id"=>"", "architecture_id"=>"1", "operatingsystem_id"=>"1", "medium_id"=>"1", "ptable_id"=>"7", "root_pass"=>"[FILTERED]", "group_parameters_attributes"=>{"0"=>{"name"=>"TestParam1", "value"=>"[FILTERED]", "hidden_value"=>"[FILTERED]", "_destroy"=>"false", "nested"=>"", "id"=>"1"}}, "location_ids"=>["", "1"], "organization_ids"=>["", "2"], "id"=>""}, "commit"=>"Submit"} 2015-03-18 11:56:46 [D] User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1 [["id", 3]] 2015-03-18 11:56:46 [D] Setting current user thread-local variable to admin 2015-03-18 11:56:46 [D] (0.1ms) SELECT COUNT(*) FROM "taxonomies" WHERE "taxonomies"."type" IN ('Organization') 2015-03-18 11:56:46 [D] Setting current organization thread-local variable to none 2015-03-18 11:56:46 [D] (0.1ms) SELECT COUNT(*) FROM "taxonomies" WHERE "taxonomies"."type" IN ('Location') 2015-03-18 11:56:46 [D] Setting current location thread-local variable to none 2015-03-18 11:56:46 [D] AuthSource Load (0.4ms) SELECT "auth_sources".* FROM "auth_sources" WHERE "auth_sources"."id" = 1 LIMIT 1 2015-03-18 11:56:46 [D] (0.1ms) SELECT id FROM "taxonomies" WHERE "taxonomies"."type" IN ('Location') LIMIT 1 2015-03-18 11:56:46 [D] (0.1ms) SELECT id FROM "taxonomies" WHERE "taxonomies"."type" IN ('Organization') LIMIT 1 2015-03-18 11:56:46 [D] Taxonomy Load (0.1ms) SELECT "taxonomies".* FROM "taxonomies" WHERE "taxonomies"."id" = ? ORDER BY title LIMIT 1 [["id", 1]] 2015-03-18 11:56:46 [D] Taxonomy Load (0.1ms) SELECT "taxonomies".* FROM "taxonomies" WHERE "taxonomies"."id" = ? ORDER BY title LIMIT 1 [["id", 2]] 2015-03-18 11:56:46 [D] GroupParameter Load (0.2ms) SELECT "parameters".* FROM "parameters" WHERE "parameters"."type" IN ('GroupParameter') AND "parameters"."reference_id" IS NULL AND "parameters"."id" IN (1) ORDER BY parameters.name 2015-03-18 11:56:46 [D] not found: Couldn't find GroupParameter with ID=1 for Hostgroup with ID= 2015-03-18 11:56:46 [I] Rendered common/404.html.erb within layouts/application (1.8ms) 2015-03-18 11:56:46 [I] Rendered layouts/base.html.erb (112.9ms) 2015-03-18 11:56:46 [I] Completed 404 Not Found in 135.5ms (Views: 117.5ms | ActiveRecord: 1.4ms)
Updated by The Foreman Bot almost 10 years ago
- Status changed from New to Ready For Testing
- Pull request https://github.com/theforeman/foreman/pull/2243 added
- Pull request deleted (
)
Updated by Tommy McNeely almost 10 years ago
- Blocked by Bug #9820: API: Hostgroup Clone does not clone parameters added
Updated by Dominic Cleal over 9 years ago
- Has duplicate Bug #11218: Cloning hostgroup containing (a/any) parameter fails added
Updated by Dominic Cleal over 9 years ago
- Has duplicate Bug #11404: UI throws 'Host group Not Found' on cloning a existing hostgroup added
Updated by Dominic Cleal over 9 years ago
- Pull request https://github.com/theforeman/foreman/pull/2563 added
- Pull request deleted (
https://github.com/theforeman/foreman/pull/2243)
Updated by Dominic Cleal over 9 years ago
- Related to Bug #8521: Host clone should include associated Puppet classes added
Updated by Marek Hulán over 9 years ago
- Pull request https://github.com/theforeman/foreman/pull/2661 added
- Pull request deleted (
https://github.com/theforeman/foreman/pull/2563)
Updated by Christine Fouant over 9 years ago
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Applied in changeset 04fa19de12d453e3d30971c3e094ed53e11605f4.
Updated by Dominic Cleal over 9 years ago
- Blocked by deleted (Bug #9820: API: Hostgroup Clone does not clone parameters)
Updated by Dominic Cleal over 9 years ago
- Assignee set to Christine Fouant
- Translation missing: en.field_release set to 63
Updated by Dominic Cleal over 9 years ago
- Related to Bug #9820: API: Hostgroup Clone does not clone parameters added
Updated by Dominic Cleal about 9 years ago
- Related to Bug #12566: New Host API changed host_parameters_attributes behavior added