Project

General

Profile

Actions

Bug #11885

closed

Viewing host group clone form deletes smart class parameter overrides

Added by Dominic Cleal over 9 years ago. Updated over 6 years ago.

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

Description

Probably since #9815, viewing the host group clone form deletes lookup_values (smart class parameter overrides) for the host group being cloned - before the form's submitted, even.

2015-09-18T12:03:00 [app] [I] Started GET "/hostgroups/5-Test1-Test2%20Test3-Test3/clone" for 127.0.0.1 at 2015-09-18 12:03:00 +0100
2015-09-18T12:03:00 [app] [I] Processing by HostgroupsController#clone as HTML
2015-09-18T12:03:00 [app] [I]   Parameters: {"id"=>"5-Test1-Test2 Test3-Test3"}
2015-09-18T12:03:00 [sql] [D]   User Load (0.1ms)  SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1  [["id", 24]]
2015-09-18T12:03:00 [app] [D] Setting current user thread-local variable to admin
2015-09-18T12:03:00 [sql] [D]   AuthSource Load (0.2ms)  SELECT "auth_sources".* FROM "auth_sources" WHERE "auth_sources"."id" = 1 LIMIT 1
2015-09-18T12:03:00 [sql] [D]   Hostgroup Load (0.3ms)  SELECT "hostgroups".* FROM "hostgroups" WHERE "hostgroups"."title" = '5-Test1-Test2 Test3-Test3' ORDER BY hostgroups.title LIMIT 1
2015-09-18T12:03:00 [sql] [D]   Hostgroup Load (0.1ms)  SELECT "hostgroups".* FROM "hostgroups" WHERE "hostgroups"."id" = ? ORDER BY hostgroups.title LIMIT 1  [["id", "5-Test1-Test2 Test3-Test3"]]
2015-09-18T12:03:00 [sql] [D]   ConfigGroup Load (0.3ms)  SELECT "config_groups".* FROM "config_groups" INNER JOIN "host_config_groups" ON "config_groups"."id" = "host_config_groups"."config_group_id" WHERE "host_config_groups"."host_id" = 5 AND "host_config_groups"."hos
t_type" = 'Hostgroup' ORDER BY config_groups.name
2015-09-18T12:03:00 [sql] [D]   LookupValue Load (0.3ms)  SELECT "lookup_values".* FROM "lookup_values" WHERE "lookup_values"."match" = 'hostgroup=Test1/Test2 Test3/Test3'
2015-09-18T12:03:00 [sql] [D]   CACHE (0.0ms)  SELECT "lookup_values".* FROM "lookup_values" WHERE "lookup_values"."match" = 'hostgroup=Test1/Test2 Test3/Test3'
2015-09-18T12:03:00 [sql] [D]    (0.1ms)  begin transaction
2015-09-18T12:03:00 [sql] [D]   LookupKey Load (0.2ms)  SELECT "lookup_keys".* FROM "lookup_keys" WHERE "lookup_keys"."id" = 110 ORDER BY lookup_keys.key LIMIT 1
2015-09-18T12:03:00 [sql] [D]   LookupValue Load (0.1ms)  SELECT "lookup_values".* FROM "lookup_values" WHERE "lookup_values"."id" = 49 LIMIT 1
2015-09-18T12:03:00 [sql] [D]   Puppetclass Load (0.2ms)  SELECT "puppetclasses".* FROM "puppetclasses" INNER JOIN "environment_classes" ON "puppetclasses"."id" = "environment_classes"."puppetclass_id" WHERE "environment_classes"."puppetclass_lookup_key_id" = 110 ORDER B
Y puppetclasses.name LIMIT 1
2015-09-18T12:03:00 [sql] [D]    (0.1ms)  SELECT MAX("audits"."version") AS max_id FROM "audits" WHERE "audits"."auditable_id" = 49 AND "audits"."auditable_type" = 'LookupValue'
2015-09-18T12:03:00 [sql] [E] Binary data inserted for `string` type on column `remote_address`
2015-09-18T12:03:00 [sql] [D]   SQL (0.6ms)  INSERT INTO "audits" ("action", "associated_id", "associated_name", "associated_type", "auditable_id", "auditable_name", "auditable_type", "audited_changes", "comment", "created_at", "remote_address", "request_uuid", "user_id" 
, "user_type", "username", "version") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)  [["action", "destroy"], ["associated_id", 110], ["associated_name", "activemq::config::server_config"], ["associated_type", "LookupKey"], ["auditable_id", 49], ["auditable_name
", "hostgroup=Test1/Test2 Test3/Test3"], ["auditable_type", "LookupValue"], ["audited_changes", "---\nmatch: hostgroup=Test1/Test2 Test3/Test3\nvalue: set in three\nlookup_key_id: 110\nuse_puppet_default: false\n"], ["comment", nil], ["created_at", Fri, 18 Sep 2015 11:03
:00 UTC +00:00], ["remote_address", "127.0.0.1"], ["request_uuid", nil], ["user_id", 24], ["user_type", nil], ["username", "Admin User"], ["version", 2]]
2015-09-18T12:03:00 [sql] [D]   SQL (0.2ms)  UPDATE "lookup_keys" SET "lookup_values_count" = COALESCE("lookup_values_count", 0) - 1 WHERE "lookup_keys"."id" IN (SELECT "lookup_keys"."id" FROM "lookup_keys" WHERE "lookup_keys"."type" IN ('PuppetclassLookupKey') AND "look
up_keys"."id" = 110 ORDER BY lookup_keys.key)
2015-09-18T12:03:00 [sql] [D]   SQL (0.1ms)  DELETE FROM "lookup_values" WHERE "lookup_values"."id" = ?  [["id", 49]]
2015-09-18T12:03:00 [sql] [D]   LookupKey Load (0.2ms)  SELECT "lookup_keys".* FROM "lookup_keys" WHERE "lookup_keys"."id" = 114 ORDER BY lookup_keys.key LIMIT 1
2015-09-18T12:03:00 [sql] [D]   LookupValue Load (0.1ms)  SELECT "lookup_values".* FROM "lookup_values" WHERE "lookup_values"."id" = 50 LIMIT 1
2015-09-18T12:03:00 [sql] [D]   Puppetclass Load (0.2ms)  SELECT "puppetclasses".* FROM "puppetclasses" INNER JOIN "environment_classes" ON "puppetclasses"."id" = "environment_classes"."puppetclass_id" WHERE "environment_classes"."puppetclass_lookup_key_id" = 114 ORDER B
Y puppetclasses.name LIMIT 1
2015-09-18T12:03:00 [sql] [D]    (0.1ms)  SELECT MAX("audits"."version") AS max_id FROM "audits" WHERE "audits"."auditable_id" = 50 AND "audits"."auditable_type" = 'LookupValue'
2015-09-18T12:03:00 [sql] [E] Binary data inserted for `string` type on column `remote_address`
2015-09-18T12:03:00 [sql] [D]   SQL (0.3ms)  INSERT INTO "audits" ("action", "associated_id", "associated_name", "associated_type", "auditable_id", "auditable_name", "auditable_type", "audited_changes", "comment", "created_at", "remote_address", "request_uuid", "user_id" 
, "user_type", "username", "version") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)  [["action", "destroy"], ["associated_id", 114], ["associated_name", "activemq::version"], ["associated_type", "LookupKey"], ["auditable_id", 50], ["auditable_name", "hostgroup=
Test1/Test2 Test3/Test3"], ["auditable_type", "LookupValue"], ["audited_changes", "---\nmatch: hostgroup=Test1/Test2 Test3/Test3\nvalue: '80'\nlookup_key_id: 114\nuse_puppet_default: false\n"], ["comment", nil], ["created_at", Fri, 18 Sep 2015 11:03:00 UTC +00:00], ["rem
ote_address", "127.0.0.1"], ["request_uuid", nil], ["user_id", 24], ["user_type", nil], ["username", "Admin User"], ["version", 2]]
2015-09-18T12:03:00 [sql] [D]   SQL (0.2ms)  UPDATE "lookup_keys" SET "lookup_values_count" = COALESCE("lookup_values_count", 0) - 1 WHERE "lookup_keys"."id" IN (SELECT "lookup_keys"."id" FROM "lookup_keys" WHERE "lookup_keys"."type" IN ('PuppetclassLookupKey') AND "look
up_keys"."id" = 114 ORDER BY lookup_keys.key)
2015-09-18T12:03:00 [sql] [D]   SQL (0.0ms)  DELETE FROM "lookup_values" WHERE "lookup_values"."id" = ?  [["id", 50]]
2015-09-18T12:03:00 [sql] [D]    (34.9ms)  commit transaction
2015-09-18T12:03:00 [sql] [D]   Puppetclass Load (0.2ms)  SELECT "puppetclasses".* FROM "puppetclasses" INNER JOIN "hostgroup_classes" ON "puppetclasses"."id" = "hostgroup_classes"."puppetclass_id" WHERE "hostgroup_classes"."hostgroup_id" = 5 ORDER BY puppetclasses.name
.....

Related issues 1 (0 open1 closed)

Related to Foreman - Bug #11425: add a real primary key to host and hostgroup for lookup_values has_manyClosedTom Caspy08/19/2015Actions
Actions

Also available in: Atom PDF