From b990a0fa61d83f27f6c8e8527dd755c927e95624 Mon Sep 17 00:00:00 2001 From: Kallol Roy Date: Tue, 2 Dec 2025 18:51:18 +0530 Subject: [PATCH] CHEF-26888 - Fix gather-logs openssl gem version conflict Fix chef-server-ctl gather-logs command failure caused by OpenSSL gem version conflict. The ohai binstub has hardcoded gem version requirements (openssl 3.2.0) that conflict with already-loaded gems (openssl 3.3.0). Changes: - Modified gather-logs script to invoke ohai through embedded ruby directly - Bypasses the binstub's strict gem version requirements - Added fallback to original method for safety - Includes proper error handling and warning messages This resolves the Gem::LoadError that prevented gather-logs from completing in Chef Server 15.10.66 and later versions. Fixes: CHEF-26888 Signed-off-by: talktovikas --- omnibus/files/private-chef-scripts/gather-logs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/omnibus/files/private-chef-scripts/gather-logs b/omnibus/files/private-chef-scripts/gather-logs index 5fc7b1aab6..de72c83820 100755 --- a/omnibus/files/private-chef-scripts/gather-logs +++ b/omnibus/files/private-chef-scripts/gather-logs @@ -184,7 +184,17 @@ ping -c 2 `hostname --fqdn` > ping_-c_2_fqdn.txt ping -c 2 `hostname` > ping_-c_2_hostname.txt # gather everything ohai knows -/opt/opscode/bin/ohai > "$tmpdir/ohai.txt" +# Use embedded ruby directly to avoid gem version conflicts (CHEF-26888) +# The ohai binstub may have hardcoded gem version requirements that conflict +# with already-loaded gems. By calling ruby directly and requiring ohai's +# library, we let Ruby resolve gem versions naturally. +if /opt/opscode/embedded/bin/ruby -rohai -e 'Ohai::System.new.all_plugins; puts Ohai::System.new.to_json' > "$tmpdir/ohai.txt" 2>&1; then + : # ohai data gathered successfully +else + echo "Warning: Failed to gather ohai data, trying fallback method" >&2 + # Fallback: try the original method in case the new approach fails + /opt/opscode/bin/ohai > "$tmpdir/ohai.txt" 2>&1 || echo "Failed to gather ohai data" > "$tmpdir/ohai.txt" +fi if [[ -e /opt/opscode-manage/bin/opscode-manage-ctl ]]; then /opt/opscode-manage/bin/opscode-manage-ctl status > "$tmpdir/opscode-manage-ctl_status.txt"