diff --git a/app/models/mixins/inter_region_api_method_relay.rb b/app/models/mixins/inter_region_api_method_relay.rb index abddb73c7a9..a80ad07f2a3 100644 --- a/app/models/mixins/inter_region_api_method_relay.rb +++ b/app/models/mixins/inter_region_api_method_relay.rb @@ -1,5 +1,3 @@ -require 'manageiq-api-client' - module InterRegionApiMethodRelay class InterRegionApiMethodRelayError < RuntimeError; end @@ -54,6 +52,7 @@ def api_relay_class_method(method, action = method) end def self.api_client_connection_for_region(region_number, user = User.current_userid) + require 'manageiq-api-client' region = MiqRegion.find_by(:region => region_number) url = region.remote_ws_url diff --git a/app/models/mixins/process_tasks_mixin.rb b/app/models/mixins/process_tasks_mixin.rb index 0a394ece698..db319d78109 100644 --- a/app/models/mixins/process_tasks_mixin.rb +++ b/app/models/mixins/process_tasks_mixin.rb @@ -1,5 +1,3 @@ -require 'manageiq-api-client' - module ProcessTasksMixin extend ActiveSupport::Concern include RetirementMixin @@ -128,6 +126,7 @@ def invoke_api_tasks(api_client, remote_options) end def send_action(action, collection_name, collection, remote_options, id = nil) + require 'manageiq-api-client' post_args = remote_options[:args] || {} begin if id.present? 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 13d74ef8c9d..d8ed9685d74 100644 --- a/spec/models/mixins/inter_region_api_method_relay_spec.rb +++ b/spec/models/mixins/inter_region_api_method_relay_spec.rb @@ -1,3 +1,5 @@ +require 'manageiq-api-client' + RSpec.describe InterRegionApiMethodRelay do let(:collection_name) { :test_class_collection } let(:api_config) { double("Api::CollectionConfig") } diff --git a/spec/models/mixins/process_tasks_mixin_spec.rb b/spec/models/mixins/process_tasks_mixin_spec.rb index 46c2482975a..a51af231498 100644 --- a/spec/models/mixins/process_tasks_mixin_spec.rb +++ b/spec/models/mixins/process_tasks_mixin_spec.rb @@ -1,3 +1,5 @@ +require 'manageiq-api-client' + RSpec.describe ProcessTasksMixin do let(:test_class) do Class.new(ApplicationRecord) do