Skip to content

Commit

Permalink
Refs #37883 - skip if non-katello & always refer to foreman DB
Browse files Browse the repository at this point in the history
  • Loading branch information
ianballou committed Nov 13, 2024
1 parent 60b31b8 commit 3c6ef7e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions hooks/pre_commit/42-evr_extension_permissions.rb
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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.")
Expand Down

0 comments on commit 3c6ef7e

Please sign in to comment.