puppetlabs / puppet-docs

Curated Puppet Documentation
Other
221 stars 303 forks source link

Custom facts examples use legacy facts #1155

Closed spotter-puppet closed 5 months ago

spotter-puppet commented 5 months ago

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

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
github-actions[bot] commented 5 months ago

Migrated issue to PUPDOC-5654

IngridaCazers commented 5 months ago

This issue was addressed and the update will be published in the next release.