Actions
Bug #11571
closedlookup_value_matcher not populated on hosts table in DB migration
Description
The AddLookupValueMatchToHostAndHostgroup migration added in #11425 doesn't populate the lookup_value_matcher field added to the host table. It only updates the updated_at timestamp:
This causes all FQDN-specific matchers to no longer match, which could lead to severe misconfigurations.
2015-08-26T12:48:36 [sql] [D] (0.1ms) begin transaction == AddLookupValueMatchToHostAndHostgroup: migrating ========================== -- add_column(:hosts, :lookup_value_matcher, :string) 2015-08-26T12:48:36 [sql] [D] (0.7ms) ALTER TABLE "hosts" ADD "lookup_value_matcher" varchar(255) -> 0.0013s -- add_column(:hostgroups, :lookup_value_matcher, :string) 2015-08-26T12:48:36 [sql] [D] (0.3ms) ALTER TABLE "hostgroups" ADD "lookup_value_matcher" varchar(255) -> 0.0006s 2015-08-26T12:48:36 [sql] [D] Host::Managed Load (0.3ms) SELECT "hosts".* FROM "hosts" WHERE "hosts"."type" IN ('Host::Managed') AND "hosts"."type" = 'Host::Managed' ORDER BY "hosts"."id" ASC LIMIT 100 2015-08-26T12:48:36 [sql] [D] Nic::Base Load (0.1ms) SELECT "nics".* FROM "nics" WHERE "nics"."host_id" = 82 ORDER BY identifier 2015-08-26T12:48:37 [sql] [D] (0.1ms) UPDATE "hosts" SET "updated_at" = '2015-08-26 11:48:37.009783' WHERE "hosts"."type" IN ('Host::Managed') AND "hosts"."id" = 82 2015-08-26T12:48:37 [sql] [D] Nic::Base Load (0.1ms) SELECT "nics".* FROM "nics" WHERE "nics"."host_id" = 109 ORDER BY identifier 2015-08-26T12:48:37 [sql] [D] Domain Load (0.1ms) SELECT "domains".* FROM "domains" WHERE "domains"."id" = 4 ORDER BY domains.name LIMIT 1 2015-08-26T12:48:37 [sql] [D] (0.2ms) UPDATE "hosts" SET "updated_at" = '2015-08-26 11:48:37.058461' WHERE "hosts"."type" IN ('Host::Managed') AND "hosts"."id" = 109 2015-08-26T12:48:37 [sql] [D] Nic::Base Load (0.1ms) SELECT "nics".* FROM "nics" WHERE "nics"."host_id" = 110 ORDER BY identifier 2015-08-26T12:48:37 [sql] [D] Domain Load (0.1ms) SELECT "domains".* FROM "domains" WHERE "domains"."id" = 6 ORDER BY domains.name LIMIT 1 2015-08-26T12:48:37 [sql] [D] (0.1ms) UPDATE "hosts" SET "updated_at" = '2015-08-26 11:48:37.062754' WHERE "hosts"."type" IN ('Host::Managed') AND "hosts"."id" = 110 2015-08-26T12:48:37 [sql] [D] Nic::Base Load (0.1ms) SELECT "nics".* FROM "nics" WHERE "nics"."host_id" = 118 ORDER BY identifier 2015-08-26T12:48:37 [sql] [D] Domain Load (0.1ms) SELECT "domains".* FROM "domains" WHERE "domains"."id" = 6 ORDER BY domains.name LIMIT 1 2015-08-26T12:48:37 [sql] [D] (0.1ms) UPDATE "hosts" SET "updated_at" = '2015-08-26 11:48:37.065953' WHERE "hosts"."type" IN ('Host::Managed') AND "hosts"."id" = 118 2015-08-26T12:48:37 [sql] [D] Nic::Base Load (0.1ms) SELECT "nics".* FROM "nics" WHERE "nics"."host_id" = 168 ORDER BY identifier 2015-08-26T12:48:37 [sql] [D] Domain Load (0.1ms) SELECT "domains".* FROM "domains" WHERE "domains"."id" = 6 ORDER BY domains.name LIMIT 1 2015-08-26T12:48:37 [sql] [D] (0.1ms) UPDATE "hosts" SET "updated_at" = '2015-08-26 11:48:37.069205' WHERE "hosts"."type" IN ('Host::Managed') AND "hosts"."id" = 168 2015-08-26T12:48:37 [sql] [D] Nic::Base Load (0.2ms) SELECT "nics".* FROM "nics" WHERE "nics"."host_id" = 170 ORDER BY identifier 2015-08-26T12:48:37 [sql] [D] Domain Load (0.1ms) SELECT "domains".* FROM "domains" WHERE "domains"."id" = 13 ORDER BY domains.name LIMIT 1 2015-08-26T12:48:37 [sql] [D] (0.1ms) UPDATE "hosts" SET "updated_at" = '2015-08-26 11:48:37.072978' WHERE "hosts"."type" IN ('Host::Managed') AND "hosts"."id" = 170
sqlite> select id,lookup_value_matcher from hosts; 82| 109| 110| 118| 168| 170|
Adding a Host.reset_column_information
call seems to make it work properly.
Actions