Skip to content

Commit

Permalink
Completely cache the Debian PostgreSQL versions
Browse files Browse the repository at this point in the history
This uses a block that won't run if @deb_postgresql_versions is already
set.
  • Loading branch information
ekohl committed Oct 17, 2024
1 parent 568845e commit c709f56
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lib/foreman_maintain/concerns/base_database.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ def deb_postgresql_data_dir
end

def deb_postgresql_versions
installed_pkgs = package_manager.list_installed_packages('${binary:Package}\n')
@deb_postgresql_versions ||= installed_pkgs.grep(/^postgresql-\d+$/).map do |name|
name.split('-').last
end
@deb_postgresql_versions
@deb_postgresql_versions ||= begin
installed_pkgs = package_manager.list_installed_packages('${binary:Package}\n')

Check failure on line 20 in lib/foreman_maintain/concerns/base_database.rb

View workflow job for this annotation

GitHub Actions / rubocop / Rubocop

Layout/LineLength: Line is too long. [118/100]
installed_pkgs.grep(/^postgresql-\d+$/).map do |name|
name.split('-').last
end
end

Check failure on line 24 in lib/foreman_maintain/concerns/base_database.rb

View workflow job for this annotation

GitHub Actions / rubocop / Rubocop

Layout/BeginEndAlignment: `end` at 24, 37 is not aligned with `@deb_postgresql_versions ||= begin` at 19, 8.
end

def postgresql_conf
Expand Down

0 comments on commit c709f56

Please sign in to comment.