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

Fix resolution of the virtual fact on FreeBSD #2744

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

smortex
Copy link
Contributor

@smortex smortex commented Jul 30, 2024

We should not call Linux-specific code from a non-Linux system. Before #2743, the Linux-specific code was unexpectedly loaded, and the Linux resolver was non-functional on FreeBSD, causing a warning to be output. With #2743, the Linux specific code is not loaded anymore, breaking further the fact resolution.

In order to fix this, the virtual_detector code needs to either be split into platform-specific pieces, or take care to only call platform-specific code on these platforms. Given this is a utility class, I chose the second route, and since the Linux-specific code is now only loaded on Linux, rely on the namespace existing or not to determine if we should run that code.

This is part 2/2 of a fix of #2742

@puppetlabs-jenkins
Copy link
Collaborator

Can one of the admins verify this patch?

@smortex
Copy link
Contributor Author

smortex commented Jul 30, 2024

Interesting failures with jRuby… I don't understand what is happening wrongly 🧐. Suggestions are welcome!

Move all files that defines Facter::Resolvers::Linux::* into the
lib/facter/resolvers/linux directory.  Also only load them on Linux
systems as they are Linux-specific.
All other filesystems resolvers are named "filesystems" (plural), so
match the same name because all these resolvers have the same purpose.
FreeBSD has containers (jails) but already handled through the 'virutal'
resolver, so for now we just consider Linux being able to handle
containers as the code aleady depend on Linux-specific resolvers.
We should not call Linux-specific code from a non-Linux system.  This
cross-platform utility class needs to skip Linux code when running on a
non-linux platform.
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