Skip to content

Resolving the virtual fact on FreeBSD produce warning #2742

Open
@smortex

Description

@smortex

Describe the Bug

root@puppet:~ # facter --version
4.8.0
root@puppet:~ # facter virtual
[2024-07-30 09:30:11.629353 ] WARN Facter::Resolvers::Containers - Unable to getenv for pid 1, 'uninitialized constant Facter::Util::Linux' 
jail

Expected Behavior

root@puppet:~ # facter virtual
jail

No warning about something that looks suspiciously Linux-related :-)

Steps to Reproduce

Run facter 4.8.0 on a FreeBSD system

Environment

  • Version 4.8.0
  • Platform FreeBSD

Additional Context

The problem is incidentally introduced by #2574 where Linux specific code is added to lib/facter/resolvers/containers.rb, a file which based on its name is supposed to be platform-agnostic.

After further investigation, this file is really platform-specific and not in the right directory. A few other files have the same problem. I will open two PR to:

  1. Fix files located in the wrong directory to make it explicit if they are specific to a platform or not: Ensure platform-specific code is correctly namespaced #2743;
  2. Change the way the virtual fact is resolved on FreeBSD to stop the warning from being produced: Fix resolution of the virtual fact on FreeBSD #2744.

Metadata

Metadata

Assignees

No one assigned

    Labels

    acceptedValid issue that we intend to work on when we have the bandwidthbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions