Jira (FACT-3093) Facter fails to resolve custom/environment facts in some circumstances

6 views
Skip to first unread message

Adam Tkac (Jira)

unread,
Nov 10, 2021, 5:09:02 AM11/10/21
to puppe...@googlegroups.com
Adam Tkac created an issue
 
Facter / Bug FACT-3093
Facter fails to resolve custom/environment facts in some circumstances
Issue Type: Bug Bug
Affects Versions: FACT 4.2.5
Assignee: Unassigned
Components: Facter 4
Created: 2021/11/10 2:08 AM
Environment:

CentOS 8 Stream
facter 4.2.5

Priority: Normal Normal
Reporter: Adam Tkac

Hello facter upstream,

when upgrading facter from 4.0.51 to the latest (4.2.5), I found that under certain circumstances, facter fails to resolve custom/environment facts.

Reproducer:

$ cat facter/1.rb
Facter.add(:ec2data_type) do
  setcode do
    "cl_ftp"
  end
end

$ cat facter/2.rb
if not Facter.value(:nonexistant_fact)
    Facter.add(:nonexistant_fact) do
      setcode do
        "asd"
      end
    end
end

# FACTER_EC2DATA_TYPE=cl_ftp FACTERLIB=$(pwd)/facter facter ec2data_type
<nothing is returned>

Feel free to ask me if you need more information.

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v8.13.2#813002-sha1:c495a97)
Atlassian logo

Ciprian Badescu (Jira)

unread,
Nov 15, 2021, 9:14:03 AM11/15/21
to puppe...@googlegroups.com
Ciprian Badescu commented on Bug FACT-3093
 
Re: Facter fails to resolve custom/environment facts in some circumstances

Adam Tkac, calling Facter.value outside setcode block is causing this kind of issues.

The same effect can be obtained using confine }}and {{has_weight statements and will be correctly solved by Facter. Can you try that?

Ciprian Badescu (Jira)

unread,
Dec 2, 2021, 1:29:02 PM12/2/21
to puppe...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages