(#11511) Split lsb facts into multiple files

If a fact is stored in a file that does not follow the convention
$factname.rb we may encounter ordering and recursion issues as seen in
bugreport #11511. The concrete example was

- flush clears all facts
- load_all is triggered to reload facts
- inside an .rb file we query the operatingsystem fact directly
  (say outside a Facter.add block)
- the operatingsystem fact has a suitable resolver for linux which
  wants to query the lsbdistid fact, which is (apperently) not yet
  loaded (this might not even be predictable)
- the loader doesnt find a lsbdistid.rb file so it triggers load_all
  (remember: we are still trying to get a value for operatingsystem)
- the load_all does load other files (like processor.rb) that want to
  query the architecture fact directly (outside a Facter.add block)
- the architecture fact is dependent on the operatingsystem fact, we are
  currently trying to resolve -> boom: recursion

This commit implements one possible fix: Split the lsb facts into
differnet files so the loader finds them. We therefore dont have to run
load_all in the middle of a fact resolution.
(#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.
[#11299] Replace facter/util/plist with cfpropertylist

Previously, the facter/util/plist library was used for plist
manipulation in OS X. This library could only handle XML plists, and
thus we needed to convert every possible plist that Facter could read to
XML before reading it. This incurred a great speed hit for anyone using
Facter with OS X.

The CFPropertyList project (https://github.com/ckruse/cfpropertylist),
maintained by Christian Kruse, is a library that can not only read XML
and Binary plist files, but also can use either the libxml, nokogiri, or
built-in REXML library to do so. This is ideal as the libxml library can
utilize c extensions to do the reading/converty and thus is quite fast.

This commit introduces the CFPropertyList project into the puppet/util
namespace, and refactors all code to use this library. The version committed
into Facter is 2.1 of the CFPropertyList library.
Namespace CFPropertyList under Puppet::Util

Previously, the code inserted into lib/puppet/util/cfpropertylist was
still being namespaced as 'CFPropertyList'.  Since CFPropertyList also
exists as Rubygem, Puppet could potentially call a different version of
CFPropertyList than the version that's been inserted into the
lib/puppet/util/cfpropertylist directory.  To remedy this, the
library has been namespaced as Puppet::Util::CFPropertylist and all code and
tests have been changed.
Update rpm spec file

This commit updates the rpm spec file to change
the ruby dependencies to version 1.8.5. It also
removes any conditionals for ruby abi, because
we can now assume ruby abi present. The
dependency on ruby is bumped to version 1.8.5,
as we can also assume this ruby version, given
that el4 is EOL. The facter version is bumped
to 1.6.8 to reflect the latest released version.
Finally, this commit removes the manual noarch
build setting, as facter is now arch-specific
because of its dependency on dmidecode.

Signed-off-by: Moses Mendoza <moses@puppetlabs.com>
(#12864) Windows: get primary DNS from registry

Windows does not expose the host's primary DNS suffix via WMI, only the
registry. This commit adds a registry helper class and will retrieve the
primary DNS suffix from the registry. In the case the primary DNS suffix
does not exist or is empty, the domain fact will fall back to using WMI
for any connection-specific DNS suffix.
(#11511) Correct lsbrelease specfile filename

All spec files should follow the convention foo_spec.rb. Rename
spec/unit/lsbrelease.rb to spec/unit/lsbrelease_spec.rb.
Merge pull request #176 from stschulte/ticket/1.6.x/11511

Split lsb facts due to nasty recursion problem
Wrap dmidecode/pciutils in ifarch block

This commit wraps the requirement of dmidecode
and pciutils in an ifarch block, because these
packages are not available on all arches.

Signed-off-by: Moses Mendoza <moses@puppetlabs.com>
Merge pull request #192 from jeffweiss/ticket/1.6.x/12864_windows_primary_dns_suffix

Ticket/1.6.x/12864 windows primary dns suffix
Revert "(#12864) Windows: get primary DNS from registry"

This reverts commit 14eee2b96f0b7f08416bd9ed5087fcaa9c6d0566 so that it
can be re-targeted to 2.0.0 based on discussions on pull request 192 and
within the ticket. The changes are re-targeted to master in pull request
193.
Merge pull request #194 from jeffweiss/maint/1.6.x/revert_windows_domain_commit

Maint/1.6.x/revert windows domain commit
Merge pull request #191 from MosesMendoza/ticket/1.6.x/update_redhat_spec_file

Ticket/1.6.x/update redhat spec file
(#14332) Correct stubbing on Ubuntu

The tests for facter fail on Ubuntu because lsbdistid is not correctly stubbed.
This patch fixes that small mistake by stubbing lsbdistid for all Linux tests,
except where the test is really about testing for Ubuntu.
(#14334) Fix dmidecode based facts on DragonFly BSD
Merge branch 'ticket/1.6.x/14334_dmidecode' into 1.6.x

* ticket/1.6.x/14334_dmidecode:
  (#14334) Fix dmidecode based facts on DragonFly BSD
Merge pull request #195 from kbarber/ticket/1.6.x/14332_ubuntu_stubbing

Ticket/1.6.x/14332 ubuntu stubbing
(#7484) Domain fact should handle only TLD

Prior to this commit, the domain fact executed "hostname" on all platforms,
however the default on Linux is that "hostname" does not return FQDN.
This causes problems when the machine only has a TLD, rather than being
in a second level domain. For example, ns01.tld vs ns01.puppetlabs.com.

This commit fixes that issue, and handles the case where hostname does
not accept the -f option on Solaris.
(#7484) Domain Fact should handle TLD

Before this commit, using hostname -f was opt-out. With this commit
it has been changed to be opt-in, to prevent problems on certain
operating systems like Solaris and HP-UX.
(#3226) Strip whitespace from fact

Prior to this commit, Facter was not removing trailing or leading
whitespace from facts. This change normalizes all facts by
stripping whitespace. However, since in some custom facts trailing
and leading whitespace may be essential, it is possible to opt
out of stripping the whitespace on certain facts.