Facter.add(:rubypath) do
setcode 'which ruby'
end
Facter.add(:rubypath) do
confine osfamily: "Windows"
# Windows uses 'where' instead of 'which'
setcode 'where ruby'
end
to something like
Facter.add(:rubypath) do
setcode 'which ruby'
end
Facter.add(:rubypath) do
confine 'os' do |os_fact|
os_fact['family'] == "Windows"
end
# Windows uses 'where' instead of 'which'
setcode 'where ruby'
end
One of the examples in https://www.puppet.com/docs/puppet/8/fact_overview.html#writing_facts_simple_resolutions-examples refers to osfamily, a legacy fact. The sample code should be changed from
to something like