Skip to content

Error: Facter: Error while resolving custom fact fact='root_home', resolution='<anonymous>': undefined method `dir' for nil:NilClass #1293

Closed
@hboetes

Description

@hboetes

Reading this code it looks like it takes windows into account.

# frozen_string_literal: true

Facter.add(:root_home) do
  setcode do
    require 'etc'
  rescue LoadError
  # Unavailable on platforms like Windows
  else
    Etc.getpwnam('root').dir
  end
end

But I always get this error, whilst running on windows.

Error: Facter: Error while resolving custom fact fact='root_home', resolution='<anonymous>': undefined method `dir' for nil:NilClass

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions