From 8fa42b28778862ea7e1b6ce216153684535814ad Mon Sep 17 00:00:00 2001 From: Jerry Keselman Date: Wed, 31 Jan 2018 16:24:33 -0500 Subject: [PATCH 1/2] Make sure Containers Before Processing The crosslink code for the Swift Manager refresh parser attempts to loop through the set of containers for the manager without checking if any exist first. Fix by checking first. --- .../swift_manager/refresh_parser/cross_linkers/openstack.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/manageiq/providers/storage_manager/swift_manager/refresh_parser/cross_linkers/openstack.rb b/app/models/manageiq/providers/storage_manager/swift_manager/refresh_parser/cross_linkers/openstack.rb index e86ce3c64f4..7ce61174ed9 100644 --- a/app/models/manageiq/providers/storage_manager/swift_manager/refresh_parser/cross_linkers/openstack.rb +++ b/app/models/manageiq/providers/storage_manager/swift_manager/refresh_parser/cross_linkers/openstack.rb @@ -11,11 +11,11 @@ def initialize(parent_ems, data) end def cross_link - @data[:cloud_object_store_containers].each do |container_hash| + @data[:cloud_object_store_containers]&.each do |container_hash| link_to_tenant(container_hash) end - @data[:cloud_object_store_objects].each do |object_hash| + @data[:cloud_object_store_objects]&.each do |object_hash| link_to_tenant(object_hash) end end From 0579193284eddc05106410f1df4c0ad5b47f5822 Mon Sep 17 00:00:00 2001 From: Jerry Keselman Date: Thu, 1 Feb 2018 16:48:52 -0500 Subject: [PATCH 2/2] Make sure Containers Exist Before Parsing Refresh Too The same check that was added to the crosslink code in the previous commit has to be added to the refresh parser cleanup code. --- .../providers/storage_manager/swift_manager/refresh_parser.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/manageiq/providers/storage_manager/swift_manager/refresh_parser.rb b/app/models/manageiq/providers/storage_manager/swift_manager/refresh_parser.rb index e6e89f00554..ce3b9ae90b0 100644 --- a/app/models/manageiq/providers/storage_manager/swift_manager/refresh_parser.rb +++ b/app/models/manageiq/providers/storage_manager/swift_manager/refresh_parser.rb @@ -123,8 +123,8 @@ def safe_list(&block) end def cleanup - @data[:cloud_object_store_containers].each { |c| c.delete(:tenant_id) } - @data[:cloud_object_store_objects].each { |c| c.delete(:tenant_id) } + @data[:cloud_object_store_containers]&.each { |c| c.delete(:tenant_id) } + @data[:cloud_object_store_objects]&.each { |c| c.delete(:tenant_id) } end end end