Project

General

Profile

Actions

Bug #9815

closed

HostGroup Clone doesn't work if the hostgroup has parameters

Added by Tommy McNeely about 9 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Normal
Category:
Host groups
Target version:
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

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 ;)


Related issues 5 (0 open5 closed)

Related to Foreman - Bug #8521: Host clone should include associated Puppet classesClosedDominic Cleal11/26/2014Actions
Related to Foreman - Bug #9820: API: Hostgroup Clone does not clone parametersClosedTommy McNeely03/18/2015Actions
Related to Foreman - Bug #12566: New Host API changed host_parameters_attributes behaviorClosedLukas Zapletal11/23/2015Actions
Has duplicate Foreman - Bug #11218: Cloning hostgroup containing (a/any) parameter failsDuplicate07/27/2015Actions
Has duplicate Foreman - Bug #11404: UI throws 'Host group Not Found' on cloning a existing hostgroupDuplicateShimon Shtein08/18/2015Actions
Actions #1

Updated by Tommy McNeely about 9 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.

Actions #2

Updated by Tommy McNeely about 9 years ago

This may be as simple as changing "param.clone" to "param.dup"

https://gist.github.com/ericsaboia/994614

Actions #3

Updated by Tommy McNeely about 9 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)
Actions #4

Updated by The Foreman Bot about 9 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/2243 added
  • Pull request deleted ()
Actions #5

Updated by Tommy McNeely about 9 years ago

  • Blocked by Bug #9820: API: Hostgroup Clone does not clone parameters added
Actions #6

Updated by Dominic Cleal over 8 years ago

  • Has duplicate Bug #11218: Cloning hostgroup containing (a/any) parameter fails added
Actions #7

Updated by Dominic Cleal over 8 years ago

  • Has duplicate Bug #11404: UI throws 'Host group Not Found' on cloning a existing hostgroup added
Actions #8

Updated by Dominic Cleal over 8 years ago

  • Pull request https://github.com/theforeman/foreman/pull/2563 added
  • Pull request deleted (https://github.com/theforeman/foreman/pull/2243)
Actions #9

Updated by Dominic Cleal over 8 years ago

  • Related to Bug #8521: Host clone should include associated Puppet classes added
Actions #10

Updated by Marek Hulán over 8 years ago

  • Pull request https://github.com/theforeman/foreman/pull/2661 added
  • Pull request deleted (https://github.com/theforeman/foreman/pull/2563)
Actions #11

Updated by Christine Fouant over 8 years ago

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

Updated by Dominic Cleal over 8 years ago

  • Blocked by deleted (Bug #9820: API: Hostgroup Clone does not clone parameters)
Actions #13

Updated by Dominic Cleal over 8 years ago

  • Assignee set to Christine Fouant
  • translation missing: en.field_release set to 63
Actions #14

Updated by Dominic Cleal over 8 years ago

  • Related to Bug #9820: API: Hostgroup Clone does not clone parameters added
Actions #15

Updated by Dominic Cleal over 8 years ago

  • Related to Bug #12566: New Host API changed host_parameters_attributes behavior added
Actions

Also available in: Atom PDF