diff --git a/lib/foreman_maintain/concerns/base_database.rb b/lib/foreman_maintain/concerns/base_database.rb index e63ed641c..8969a5f28 100644 --- a/lib/foreman_maintain/concerns/base_database.rb +++ b/lib/foreman_maintain/concerns/base_database.rb @@ -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') + installed_pkgs.grep(/^postgresql-\d+$/).map do |name| + name.split('-').last + end + end end def postgresql_conf