Skip to content

Fix resolution of the virtual fact on FreeBSD #16

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

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

Conversation

smortex
Copy link
Member

@smortex smortex commented Jun 16, 2025

We should not call Linux-specific code from a non-Linux system. Before #15, the Linux-specific code was unexpectedly loaded, and the Linux resolver was non-functional on FreeBSD, causing a warning to be output. With #15, 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.

Originally submitted as:
puppetlabs/facter#2744

smortex added 3 commits June 16, 2025 07:56
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.
bastelfreak
bastelfreak previously approved these changes Jun 16, 2025
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.
@smortex
Copy link
Member Author

smortex commented Jun 17, 2025

I fixed the mistakes that caused the jRuby failures. Interesting it did not failed with other implementations of Ruby 🤷

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