Skip to content

Commit

Permalink
Use local_advisor_engine naming
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremylenz committed Jan 8, 2025
1 parent 1592aff commit 60de70c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/controllers/insights_cloud/settings_controller.rb
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 3 additions & 3 deletions lib/foreman_rh_cloud/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
4 changes: 2 additions & 2 deletions test/controllers/insights_sync/settings_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 60de70c

Please sign in to comment.