puppetlabs/facter — pull request #186 by stschulte (2012-03-06 20:11:57+00:00)
Title: (#12790) Raise an exception if recursion is detected

Facter can already detect fact dependency cycles (fact recursions).

Without this patch facter will return nil (or an already cached value)
as a factvalue when a recursion is detected. This can silently break
things. Example

Facter.add(:foo)
if Facter.value(:bar) != 'baz'
something happens here
end
end

If there is now a recursion when querying the bar fact we will always
execute the following codeblock (nil != baz). This may lead to strange
and inexplicable results for the foo fact.

The fix now changes the behaviour when a recursion is detected: Do not
just print a debug message but throw an error. This way a recursion is
a lot easier to detect and we can actually fix it.