Skip to content

Commit ddd80c3

Browse files
authored
CHEF-26888 - Fix gather-logs openssl gem version conflict (#4127)
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 <vikas.yadav@progress.com>
1 parent 1065328 commit ddd80c3

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

omnibus/files/private-chef-scripts/gather-logs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,17 @@ ping -c 2 `hostname --fqdn` > ping_-c_2_fqdn.txt
184184
ping -c 2 `hostname` > ping_-c_2_hostname.txt
185185

186186
# gather everything ohai knows
187-
/opt/opscode/bin/ohai > "$tmpdir/ohai.txt"
187+
# Use embedded ruby directly to avoid gem version conflicts (CHEF-26888)
188+
# The ohai binstub may have hardcoded gem version requirements that conflict
189+
# with already-loaded gems. By calling ruby directly and requiring ohai's
190+
# library, we let Ruby resolve gem versions naturally.
191+
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
192+
: # ohai data gathered successfully
193+
else
194+
echo "Warning: Failed to gather ohai data, trying fallback method" >&2
195+
# Fallback: try the original method in case the new approach fails
196+
/opt/opscode/bin/ohai > "$tmpdir/ohai.txt" 2>&1 || echo "Failed to gather ohai data" > "$tmpdir/ohai.txt"
197+
fi
188198

189199
if [[ -e /opt/opscode-manage/bin/opscode-manage-ctl ]]; then
190200
/opt/opscode-manage/bin/opscode-manage-ctl status > "$tmpdir/opscode-manage-ctl_status.txt"

0 commit comments

Comments
 (0)