Skip to content

Commit

Permalink
Bad skipping of assert in production env
Browse files Browse the repository at this point in the history
Bad skipping of assert in production env, the return was causing
lazy_find to behave badly in production env.
  • Loading branch information
Ladas committed Mar 19, 2018
1 parent 8246d91 commit 5ac2e07
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 5ac2e07

Please sign in to comment.