Added osfamily fact to determine if a given operating system is a derivative of a common operating system.
Signed-off-by: Adrien Thebo <adr...@puppetlabs.com> --- Local-branch: ticket/master/6792 lib/facter/osfamily.rb | 24 ++++++++++++++++++++++++ 1 files changed, 24 insertions(+), 0 deletions(-) create mode 100644 lib/facter/osfamily.rb diff --git a/lib/facter/osfamily.rb b/lib/facter/osfamily.rb new file mode 100644 index 0000000..b580034 --- /dev/null +++ b/lib/facter/osfamily.rb @@ -0,0 +1,24 @@ +# Fact: osfamily +# +# Purpose: Returns the operating system +# +# Resolution: +# On Redhat and derivatives, returns redhat +# On Debian and derivatives, returns debian +# Else, returns the kernel +# +# Caveats: +# + +Facter.add(:osfamily) do + + setcode do + if FileTest.exists?("/etc/redhat-release") + "redhat" + elsif FileTest.exists?("/etc/debian_version") + "debian" + else + Facter.kernel + end + end +end -- 1.7.4.1 -- You received this message because you are subscribed to the Google Groups "Puppet Developers" group. To post to this group, send email to puppet-dev@googlegroups.com. To unsubscribe from this group, send email to puppet-dev+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.