CentOS 8 Stream facter 4.2.5
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
$ cat facter/2.rb
if not Facter.value(:nonexistant_fact)
Facter.add(:nonexistant_fact) do
"asd"
# FACTER_EC2DATA_TYPE=cl_ftp FACTERLIB=$(pwd)/facter facter ec2data_type
<nothing is returned>
Feel free to ask me if you need more information.
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?
Adam Tkac, thank you for feedback!