chef / ohai

Ohai profiles your system and emits JSON
https://docs.chef.io/ohai.html
Apache License 2.0
681 stars 452 forks source link

Monkey Patching Ohai to overcome issues with the Resolv class #1820

Closed johnmccrae closed 5 months ago

johnmccrae commented 5 months ago

Description

In Chef, the Win32/registry class that's native to Ruby does some rude things with encoding that we monkeypatched for. That patch has worked great for a number of years. We recently took an update here for Ohai to overcome and issue FQDN's not displaying correctly for Windows nodes. PR #1816

The new code relies on the Resolv class to update node networking details. The unintended side effect of using the Resolv class is that it unilaterally re-installs the Win32/Registry class which essentially overwrites the monkey patch. Here we apply it to Ohai too.

This code be a breaking change since registry keys were previously retrieved with UTF16-LE encoding and will now be retrieved with UTF-8 encoding.

Related Issue

Types of changes

Checklist:

sonarcloud[bot] commented 5 months ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud