From 035fdc0d27a06dd6e769eda142ecea64fd2d1d76 Mon Sep 17 00:00:00 2001 From: Bernhard Suttner Date: Tue, 5 Mar 2024 09:43:07 +0100 Subject: [PATCH] Fix rails constants warning This fixes: lib/foreman_discovery/engine.rb:302: warning: already initialized constant ForemanDiscovery::Engine::MANAGER lib/foreman_discovery/engine.rb:271: warning: previous definition of MANAGER was here --- lib/foreman_discovery/engine.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/foreman_discovery/engine.rb b/lib/foreman_discovery/engine.rb index 53fc0efc..0830baf8 100644 --- a/lib/foreman_discovery/engine.rb +++ b/lib/foreman_discovery/engine.rb @@ -266,7 +266,7 @@ class Engine < ::Rails::Engine # discovered_rules :view_discovery_rules, ] - MANAGER = READER + [ + manager_permissions = READER + [ # core permissions :create_hosts, :edit_hosts, @@ -297,8 +297,9 @@ class Engine < ::Rails::Engine :destroy_discovery_rules, ] if defined?(ForemanPuppet::Engine) - MANAGER += [ :view_environments, :view_puppetclasses ] + manager_permissions += [ :view_environments, :view_puppetclasses ] end + MANAGER= manager_permissions role "Discovery Reader", READER, "Role granting permissions to view discovered hosts" role "Discovery Manager", MANAGER, "Role granting permissions to perform provisioning of discovered hosts"