Details
-
Improvement
-
Status: Closed
-
Normal
-
Resolution: Fixed
-
FACT 3.11.4
-
None
-
Platform OS
-
Platform OS Kanban
-
Bug Fix
-
-
Needs Assessment
Description
As a user of Facter, I would expect that a custom fact, with weight > 0, and with confines which have it result in being not suitable for the current system should not replace the built-in fact with an empty result.
Or, put more generally, I would expect facter to pick the highest weighted fact available from the set of facts where the confines return success.
Example with a fact in myfacts/custom.rb:
Facter.add(:timezone) do
|
has_weight 10
|
confine { File.exist?('/tmp/fact_trigger') }
|
setcode do
|
'my_custom_timezone'
|
end
|
end
|
and:
$ facter timezone
|
UTC
|
then, as expected:
$ touch /tmp/fact_trigger
|
$ facter --custom-dir=myfacts timezone
|
my_custom_timezone
|
after removing /tmp/fact_trigger, causing the confine to fail:
$ rm /tmp/fact_trigger
|
$ facter --custom-dir=myfacts timezone
|
|
$
|
what I would have expected to happen is:
$ rm /tmp/fact_trigger
|
$ facter --custom-dir=myfacts timezone
|
UTC
|
$
|
The behavior as it is today prevents targeted fixing of particular facts on specific platforms that don't work as well as on other platforms by narrowing down the scope with confines.
Thank you.