From 3ef20e37cefe1e472be515959131be58e852c2b1 Mon Sep 17 00:00:00 2001 From: Ben Roberts Date: Mon, 11 Aug 2014 22:48:35 +0100 Subject: [PATCH] Add an osfamily fact to define Sabayon as a Gentoo derivative --- lib/facter/osfamily.rb | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) 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..27bcad4 --- /dev/null +++ b/lib/facter/osfamily.rb @@ -0,0 +1,39 @@ +# Fact: osfamily +# +# Purpose: Returns the operating system +# +# Resolution: +# Maps operating systems to operating system families, such as linux +# distribution derivatives. Adds mappings from specific operating systems +# to kernels in the case that it is relevant. +# +# Caveats: +# This fact is completely reliant on the operatingsystem fact, and no +# heuristics are used +# + +Facter.add(:osfamily) do + + has_weight(10) + + setcode do + case Facter.value(:operatingsystem) + when "RedHat", "Fedora", "CentOS", "Scientific", "SLC", "Ascendos", "CloudLinux", "PSBM", "OracleLinux", "OVS", "OEL", "Amazon", "XenServer" + "RedHat" + when "LinuxMint", "Ubuntu", "Debian", "CumulusLinux" + "Debian" + when "SLES", "SLED", "OpenSuSE", "SuSE" + "Suse" + when "Solaris", "Nexenta", "OmniOS", "OpenIndiana", "SmartOS" + "Solaris" + when "Gentoo", "Sabayon" + "Gentoo" + when "Archlinux" + "Archlinux" + when "Mageia", "Mandriva", "Mandrake" + "Mandrake" + else + Facter.value("kernel") + end + end +end