From 5ac2e07358f003505dea58d3b0c91ba317235c74 Mon Sep 17 00:00:00 2001 From: Ladislav Smola Date: Mon, 19 Mar 2018 21:52:06 +0100 Subject: [PATCH] Bad skipping of assert in production env Bad skipping of assert in production env, the return was causing lazy_find to behave badly in production env. --- .../manager_refresh/inventory_collection/index/proxy.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/app/models/manager_refresh/inventory_collection/index/proxy.rb b/app/models/manager_refresh/inventory_collection/index/proxy.rb index a987d068556..4375f272610 100644 --- a/app/models/manager_refresh/inventory_collection/index/proxy.rb +++ b/app/models/manager_refresh/inventory_collection/index/proxy.rb @@ -73,7 +73,7 @@ def find(reference, ref: primary_index_ref) # TODO(lsmola) lazy_find will support only hash, then we can remove the _by variant # TODO(lsmola) this method should return lazy too, the rest of the finders should be deprecated return if reference.nil? - return unless assert_index(reference, ref) + assert_index(reference, ref) reference = inventory_collection.build_reference(reference, ref) @@ -103,7 +103,7 @@ def lazy_find(manager_uuid, ref: primary_index_ref, key: nil, default: nil) # access the data # TODO(lsmola) lazy_find will support only hash, then we can remove the _by variant return if manager_uuid.nil? - return unless assert_index(manager_uuid, ref) + assert_index(manager_uuid, ref) ::ManagerRefresh::InventoryObjectLazy.new(inventory_collection, manager_uuid, @@ -203,8 +203,6 @@ def assert_index(manager_uuid, ref) # Assert the that possible relation is nil or InventoryObject or InventoryObjectlazy class assert_relation_keys({named_ref(ref).first => manager_uuid}, ref) end - - true rescue => e _log.error("Error when asserting index: #{manager_uuid}, with ref: #{ref} of: #{inventory_collection}") raise e