From 6dd8ff3a2f8fe710185964342f88fce5b251d1d9 Mon Sep 17 00:00:00 2001 From: Ben Roberts Date: Sun, 27 Jul 2014 17:12:23 +0100 Subject: [PATCH] Update operatingsystem fact to support Sabayon the official way --- lib/facter/operatingsystem.rb | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/lib/facter/operatingsystem.rb b/lib/facter/operatingsystem.rb index cbd08ec..d757a9c 100644 --- a/lib/facter/operatingsystem.rb +++ b/lib/facter/operatingsystem.rb @@ -1,11 +1,13 @@ Facter.add(:operatingsystem) do - confine :kernel => :linux - confine :has_entropy => true + # Sabayon Linux is a variant of Gentoo so this resolution needs to come + # before the Gentoo resolution. + has_weight(10) + confine :kernel => :linux - setcode do - if FileTest.exists?("/etc/sabayon-release") - "Sabayon" - end - end + setcode do + release_info = Facter::Util::Operatingsystem.os_release + if release_info['NAME'] == "Sabayon" + 'Sabayon' + end + end end -