diff --git a/app/models/mixins/inter_region_api_method_relay.rb b/app/models/mixins/inter_region_api_method_relay.rb index 6327d506999..abddb73c7a9 100644 --- a/app/models/mixins/inter_region_api_method_relay.rb +++ b/app/models/mixins/inter_region_api_method_relay.rb @@ -80,6 +80,11 @@ def self.exec_api_call(region, collection_name, action, api_args = nil, id = nil result.attributes when ManageIQ::API::Client::Resource instance_for_resource(result) + when Hash + # Some of API invocation returning Hash object + # Example: retire_resource for Service + _log.warn("remote API invocation returned Hash object") + result else raise InterRegionApiMethodRelayError, "Got unexpected API result object #{result.class}" end diff --git a/spec/models/mixins/inter_region_api_method_relay_spec.rb b/spec/models/mixins/inter_region_api_method_relay_spec.rb index 4fb538fbfce..057cf499f17 100644 --- a/spec/models/mixins/inter_region_api_method_relay_spec.rb +++ b/spec/models/mixins/inter_region_api_method_relay_spec.rb @@ -228,6 +228,11 @@ def expect_api_call(expected_action, expected_args = nil) }.to raise_error(described_class::InterRegionApiMethodRelayError) end + it "accepts Hash object as api result" do + expect(api_collection).to receive(action).and_return({}) + expect { described_class.exec_api_call(region, collection_name, action) }.not_to raise_error + end + it "calls the given action with the given args" do args = {:my => "args", :here => 123} expect(api_collection).to receive(action).with(args).and_return(api_success_result)