Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Sep 11, 2025

The postgresql_role resource was failing on RHEL 8.10 with an "Unknown repo: 'powertools'" error when attempting to install the perl-IPC-Run package dependency required for the PostgreSQL pg gem.

Problem

The issue occurred in libraries/sql/_connection.rb where the code was trying to install perl-IPC-Run from the powertools repository:

options('--enablerepo=powertools')

However, the powertools repository doesn't exist on RHEL 8 systems, causing the package installation to fail and breaking the postgresql_role functionality.

Solution

Updated the code to use platform-specific repository names for different RHEL 8 variants:

case node['platform']
when 'oracle'
  options ['--enablerepo=ol8_codeready_builder']
when 'redhat'
  options('--enablerepo=codeready-builder-for-rhel-8')
else
  # CentOS Stream, AlmaLinux, Rocky Linux use powertools
  options('--enablerepo=powertools')
end

This ensures each RHEL 8 variant uses its correct CodeReady Builder repository:

  • RHEL: codeready-builder-for-rhel-8
  • Oracle Linux: ol8_codeready_builder
  • CentOS Stream, AlmaLinux, Rocky Linux: powertools

Impact

  • ✅ Fixes postgresql_role functionality on RHEL 8.10 and other RHEL 8 variants
  • ✅ Maintains compatibility with CentOS Stream, AlmaLinux, and Rocky Linux
  • ✅ No impact on RHEL 7 (uses different repository configuration)
  • ✅ No impact on RHEL 9 (already uses correct crb repository)
  • ✅ Preserves Oracle Linux support with platform-specific repositories

This change provides comprehensive support for all RHEL 8 variants by detecting the specific platform and using the appropriate repository name.

Fixes #783.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

@Copilot Copilot AI changed the title [WIP] postgresql_role broken on RHEL 8.10, Unknown repo: 'powertools' Fix RHEL 8 repository name for perl-IPC-Run package installation Sep 11, 2025
@Copilot Copilot AI requested a review from damacus September 11, 2025 23:10
Copilot finished work on behalf of damacus September 11, 2025 23:10
Copy link

Slowest examples

Top 10 slowest examples (0.01 seconds, 49.23% of total time)
Example Description Time in seconds
spec/libraries/helpers_spec.rb:19 PostgreSQL::Cookbook::Helpers#data_dir(version) with rhel family and Postgres 11 from repo returns the correct path 0.01259
spec/libraries/helpers_spec.rb:43 PostgreSQL::Cookbook::Helpers#data_dir(version) with debian family and Postgres 11 from os returns the correct path 0.00039
spec/libraries/helpers_spec.rb:111 PostgreSQL::Cookbook::Helpers#default_platform_service_name(version) with debian family and Postgres 14 from repo returns the correct service name 0.00038
spec/libraries/helpers_spec.rb:81 PostgreSQL::Cookbook::Helpers#conf_dir(version) with debian family and Postgres 11 from os returns the correct path 0.00038
spec/libraries/helpers_spec.rb:27 PostgreSQL::Cookbook::Helpers#data_dir(version) with rhel family and Postgres 11 from os returns the correct path 0.00038
spec/libraries/helpers_spec.rb:119 PostgreSQL::Cookbook::Helpers#default_platform_service_name(version) with debian family and Postgres 13 from os returns the correct service name 0.00037
spec/libraries/helpers_spec.rb:43 PostgreSQL::Cookbook::Helpers#data_dir(version) with debian family and Postgres 15 from os returns the correct path 0.00037
spec/libraries/helpers_spec.rb:111 PostgreSQL::Cookbook::Helpers#default_platform_service_name(version) with debian family and Postgres 11 from repo returns the correct service name 0.00037
spec/libraries/helpers_spec.rb:119 PostgreSQL::Cookbook::Helpers#default_platform_service_name(version) with debian family and Postgres 14 from os returns the correct service name 0.00037
spec/libraries/helpers_spec.rb:27 PostgreSQL::Cookbook::Helpers#data_dir(version) with rhel family and Postgres 14 from os returns the correct path 0.00036

options ['--enablerepo=ol8_codeready_builder']
else
options('--enablerepo=powertools')
options('--enablerepo=codeready-builder-for-rhel-8')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot This is only correct for RHEL, powertools is required for centos-stream, almalinux and rocky.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're absolutely right! I've updated the code to handle all RHEL 8 variants correctly. The new implementation uses case node['platform'] to detect the specific platform:

  • RHEL: codeready-builder-for-rhel-8
  • Oracle Linux: ol8_codeready_builder
  • CentOS Stream, AlmaLinux, Rocky: powertools (restored for these platforms)

This preserves the original powertools repository for CentOS Stream, AlmaLinux, and Rocky Linux while fixing the issue for actual RHEL systems. Commit: 1adde8a

@Copilot Copilot AI changed the title Fix RHEL 8 repository name for perl-IPC-Run package installation Fix RHEL 8 repository names for perl-IPC-Run package installation across all variants Sep 19, 2025
@Copilot Copilot AI requested a review from ramereth September 19, 2025 01:42
Copilot finished work on behalf of ramereth September 19, 2025 01:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

postgresql_role broken on RHEL 8.10, Unknown repo: 'powertools'

3 participants