From 4043d24a7bf3c7603f2f7b6ba559b16057eb4bf4 Mon Sep 17 00:00:00 2001 From: Beni Cherniavsky-Paskin Date: Mon, 10 Jul 2017 15:19:15 +0300 Subject: [PATCH] Simplify lazy_find_* methods using lazy_find_by --- .../kubernetes/container_manager/refresh_parser.rb | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/app/models/manageiq/providers/kubernetes/container_manager/refresh_parser.rb b/app/models/manageiq/providers/kubernetes/container_manager/refresh_parser.rb index ab8378e669..c0fc7327f0 100644 --- a/app/models/manageiq/providers/kubernetes/container_manager/refresh_parser.rb +++ b/app/models/manageiq/providers/kubernetes/container_manager/refresh_parser.rb @@ -1269,29 +1269,23 @@ def lazy_find_node(name:) def lazy_find_replicator(hash) return nil if hash.nil? - index = "#{hash[:namespace]}__#{hash[:name]}" - @inv_collections[:container_replicators].lazy_find(index, :ref => :by_namespace_and_name) + @inv_collections[:container_replicators].lazy_find_by(hash, :ref => :by_namespace_and_name) end def lazy_find_container_group(hash) return nil if hash.nil? - index = "#{hash[:namespace]}__#{hash[:name]}" - @inv_collections[:container_groups].lazy_find(index, :ref => :by_namespace_and_name) + @inv_collections[:container_groups].lazy_find_by(hash, :ref => :by_namespace_and_name) end def lazy_find_image(hash) return nil if hash.nil? hash = hash.merge(:container_image_registry => lazy_find_image_registry(hash[:container_image_registry])) - @inv_collections[:container_images].lazy_find( - @inv_collections[:container_images].object_index(hash) - ) + @inv_collections[:container_images].lazy_find_by(hash) end def lazy_find_image_registry(hash) return nil if hash.nil? - @inv_collections[:container_image_registries].lazy_find( - @inv_collections[:container_image_registries].object_index(hash) - ) + @inv_collections[:container_image_registries].lazy_find_by(hash) end end end