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

(FACT-3207) Don't rescue NoMethodError in base resolver #2591

Merged
merged 1 commit into from
Jul 20, 2023

Conversation

AriaXLi
Copy link
Contributor

@AriaXLi AriaXLi commented Jul 10, 2023

This commit removes the logic to specifically rescue for just NoMethodError.
Instead, since NameError is a superclass of NoMethodError, NoMethodErrors will
be rescued when NameError is rescued and log at the error level instead of the
debug level. By doing this, bugs in resolvers are no longer hidden.

This commit also fixes various bugs in resolvers such as calling methods on nil
objects and requiring/relying gems that may not be installed to resolve facts.

@AriaXLi AriaXLi requested a review from a team as a code owner July 10, 2023 22:05
@AriaXLi AriaXLi force-pushed the FACT-3207_nomethoderror branch 6 times, most recently from c10bfd8 to ed29723 Compare July 12, 2023 18:20
@AriaXLi
Copy link
Contributor Author

AriaXLi commented Jul 12, 2023

jenkins please test this on all

@AriaXLi AriaXLi force-pushed the FACT-3207_nomethoderror branch 2 times, most recently from e6f8b20 to 600ff20 Compare July 12, 2023 23:29
@AriaXLi
Copy link
Contributor Author

AriaXLi commented Jul 12, 2023

jenkins please test this on osx12-ARM64

@joshcooper
Copy link
Contributor

Ah looks like you found another resolver bug. I wonder if this was causing the sporadic macOS 12 issue we were seeing in CI?

17:02:09       [2023-07-12 17:02:09.318190 ] ERROR Facter::Resolvers::Macosx::Mountpoints - Resolving fact mountpoints, but got dlopen(/opt/puppetlabs/puppet/lib/ruby/gems/3.2.0/gems/ffi-1.15.5/lib/ffi_c.bundle, 0x0009): tried: '/opt/puppetlabs/puppet/lib/ruby/gems/3.2.0/gems/ffi-1.15.5/lib/ffi_c.bundle' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')) - /opt/puppetlabs/puppet/lib/ruby/gems/3.2.0/gems/ffi-1.15.5/lib/ffi_c.bundle at <internal:/opt/puppetlabs/puppet/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:85:in `require' 

@AriaXLi

This comment was marked as duplicate.

@AriaXLi

This comment was marked as duplicate.

@AriaXLi

This comment was marked as duplicate.

@AriaXLi AriaXLi added the blocked PRs blocked on work external to the PR itself label Jul 18, 2023
@AriaXLi
Copy link
Contributor Author

AriaXLi commented Jul 18, 2023

This PR is blocked by PA-5666. I cannot merge this PR since osx12-ARM64 facter builds are failing and erroring for 47 tests with my changes because the wrong architecture is being used when installing the ffi gem.

Update: osx 12 arm was temporarily removed as a test target from puppet-agent and will be added back when PA-5666 is resolved so this PR is no longer blocked

@AriaXLi AriaXLi removed the blocked PRs blocked on work external to the PR itself label Jul 19, 2023
This commit removes the logic to specifically rescue for just NoMethodError.
Instead, since NameError is a superclass of NoMethodError, NoMethodErrors will
be rescued when NameError is rescued and log at the error level instead of the
debug level. By doing this, bugs in resolvers are no longer hidden.

This commit also fixes various bugs in resolvers such as calling methods on nil
objects and requiring/relying gems that may not be installed to resolve facts.
@AriaXLi

This comment was marked as duplicate.

1 similar comment
@AriaXLi
Copy link
Contributor Author

AriaXLi commented Jul 20, 2023

jenkins please test this on all

@AriaXLi AriaXLi merged commit fb64246 into puppetlabs:main Jul 20, 2023
18 checks passed
@AriaXLi AriaXLi deleted the FACT-3207_nomethoderror branch July 20, 2023 21:28
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.

2 participants