From 60de70cbe3870dbc3ae29bc9ee3e55753204dc4e Mon Sep 17 00:00:00 2001 From: Jeremy Lenz Date: Wed, 8 Jan 2025 15:45:56 -0500 Subject: [PATCH] Use local_advisor_engine naming --- app/controllers/insights_cloud/settings_controller.rb | 2 +- lib/foreman_rh_cloud/engine.rb | 6 +++--- test/controllers/insights_sync/settings_controller_test.rb | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/controllers/insights_cloud/settings_controller.rb b/app/controllers/insights_cloud/settings_controller.rb index dc5d4dab..202901b0 100644 --- a/app/controllers/insights_cloud/settings_controller.rb +++ b/app/controllers/insights_cloud/settings_controller.rb @@ -1,7 +1,7 @@ module InsightsCloud class SettingsController < ::ApplicationController def show - if ForemanRhCloud.with_insights_on_premise? + if ForemanRhCloud.with_local_advisor_engine? render json: { error: _('This Foreman is configured to use Insights on Premise. Syncing to Insights Cloud is disabled.'), }, status: :unprocessable_entity diff --git a/lib/foreman_rh_cloud/engine.rb b/lib/foreman_rh_cloud/engine.rb index 89f7428f..4db2091b 100644 --- a/lib/foreman_rh_cloud/engine.rb +++ b/lib/foreman_rh_cloud/engine.rb @@ -113,7 +113,7 @@ def self.register_scheduled_task(task_class, cronline) url: '/foreman_rh_cloud/inventory_upload', url_hash: { controller: :react, action: :index }, parent: :configure_menu, - if: -> { !ForemanRhCloud.with_insights_on_premise? } + if: -> { !ForemanRhCloud.with_local_advisor_engine? } menu :top_menu, :insights_hits, caption: N_('Recommendations'), url: '/foreman_rh_cloud/insights_cloud', url_hash: { controller: :react, action: :index }, parent: :configure_menu register_facet InsightsFacet, :insights do @@ -200,7 +200,7 @@ def self.register_scheduled_task(task_class, cronline) end end - def self.with_insights_on_premise? - SETTINGS&.[](:insights)&.[](:use_insights_on_premise) || false + def self.with_local_advisor_engine? + SETTINGS&.[](:foreman_rh_cloud)&.[](:use_local_advisor_engine) || false end end diff --git a/test/controllers/insights_sync/settings_controller_test.rb b/test/controllers/insights_sync/settings_controller_test.rb index 05814e19..80729b15 100644 --- a/test/controllers/insights_sync/settings_controller_test.rb +++ b/test/controllers/insights_sync/settings_controller_test.rb @@ -3,11 +3,11 @@ class SettingsControllerTest < ActionController::TestCase tests InsightsCloud::SettingsController def setup - ForemanRhCloud.stubs(:with_insights_on_premise?).returns(false) + ForemanRhCloud.stubs(:with_local_advisor_engine?).returns(false) end test 'should return error if insights on premise' do - ForemanRhCloud.stubs(:with_insights_on_premise?).returns(true) + ForemanRhCloud.stubs(:with_local_advisor_engine?).returns(true) get :show, session: set_session_user