The Puppet Labs Issue Tracker has Moved: https://tickets.puppetlabs.com

Bug #15353

Single fact and full facter run can produce different results for the same fact.

Added by Matthaus Owens almost 2 years ago. Updated over 1 year ago.

Status:AcceptedStart date:07/03/2012
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:-
Target version:-
Keywords: Affected Facter version:
Branch:

We've Moved!

Ticket tracking is now hosted in JIRA: https://tickets.puppetlabs.com

This ticket may be automatically exported to the FACT project on JIRA using the button below:


Description

The way that facter loads a single fact vs all facts causes discrepancies if the same fact is defined twice (it’s possible defining a fact twice should be considered an error). In this simple example, there are two facts in lib/facter, bar.rb and foo.rb.

The single fact looks for $factname.rb in the facter path and returns the first it finds, while the facter run will load all facts in a sorted order, and load the first fact in that sort.

bar.rb

Facter.add('foo') do
  setcode do
    "foo bar"
  end
end

foo.rb

Facter.add('foo') do
  setcode do
    "bar foo"
  end
end
root@deb6-64:~# facter foo
bar foo
root@deb6-64:~# facter -p | grep foo
foo => foo bar

History

#1 Updated by Matthaus Owens almost 2 years ago

  • Description updated (diff)

#2 Updated by Anonymous almost 2 years ago

  • Status changed from Unreviewed to Investigating

#3 Updated by Andrew Parker over 1 year ago

  • Status changed from Investigating to Accepted

Also available in: Atom PDF