Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
wants to merge 20 commits into from

Conversation

johnmccrae
Copy link
Contributor

@johnmccrae johnmccrae commented Mar 21, 2024

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

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Chore (non-breaking change that does not add functionality or fix an issue)

Checklist:

  • I have read the CONTRIBUTING document.
  • I have run the pre-merge tests locally and they pass.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • If Gemfile.lock has changed, I have used --conservative to do it and included the full output in the Description above.
  • All new and existing tests passed.
  • All commits have been signed-off for the Developer Certificate of Origin.

@johnmccrae johnmccrae requested review from a team as code owners March 21, 2024 13:23
@johnmccrae johnmccrae force-pushed the jfm/chef17-monkey-patching-win32 branch from 948bf6a to 2d4bf72 Compare March 21, 2024 13:33
Signed-off-by: John <[email protected]>
Signed-off-by: John <[email protected]>
Copy link

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

@johnmccrae johnmccrae closed this Mar 27, 2024
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.

1 participant