diff --git a/hooks/pre_commit/42-evr_extension_permissions.rb b/hooks/pre_commit/42-evr_extension_permissions.rb index 85e89a46..e9254f73 100644 --- a/hooks/pre_commit/42-evr_extension_permissions.rb +++ b/hooks/pre_commit/42-evr_extension_permissions.rb @@ -1,8 +1,8 @@ # Managed databases will be handled automatically. return if local_postgresql? +return unless katello_enabled? -database = param_value('foreman', 'db_database') || 'foreman' -config = load_db_config(database) +config = load_db_config('foreman') # If postgres is the owner of the DB, then the permissions will not matter. return if config[:username] == 'postgres' @@ -24,7 +24,7 @@ # The evr extension is owned by the foreman DB owner, so we can skip this check. return when '1' - fail_and_exit("The evr extension is not owned by the #{database} DB owner. Please run the following command to fix it: " \ + fail_and_exit("The evr extension is not owned by the foreman DB owner. Please run the following command to fix it: " \ "UPDATE pg_extension SET extowner = (SELECT oid FROM pg_authid WHERE rolname='#{config[:username]}') WHERE extname='evr';") else fail_and_exit("Failed to check the ownership of the evr extension.")