From 478b32a7d2c47a8e79c0acd8665927116ecf2400 Mon Sep 17 00:00:00 2001 From: Richard Oliveri Date: Tue, 6 Feb 2018 11:56:23 -0500 Subject: [PATCH] Merge pull request #16922 from jerryk55/fix_swift_refresher_with_empty_containers Make sure Containers Exist Before Processing (cherry picked from commit 530eb073efbedc759b510b5071bceace9a0d6677) Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1542741 --- .../providers/storage_manager/swift_manager/refresh_parser.rb | 4 ++-- .../swift_manager/refresh_parser/cross_linkers/openstack.rb | 4 ++-- 2 files changed, 4 insertions(+), 4 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 d4fb6b622af..7c843a56a1f 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 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 db3ad436d3f..e848410c899 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