From 30d919b0b82f0ae3fb13fdf5f691871a9e8fbb75 Mon Sep 17 00:00:00 2001 From: Alex Schultz Date: Mon, 23 Mar 2020 16:52:31 -0600 Subject: [PATCH] Switch os_package_type to use os fact The operatingsystem fact is a legacy fact and we can use the $::os facts instead. Change-Id: I9e793b20ecc57fbd2b481a5bd53a317c54a3fa12 --- lib/facter/os_package_type.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/facter/os_package_type.rb b/lib/facter/os_package_type.rb index 134509ea..6b54c6ab 100644 --- a/lib/facter/os_package_type.rb +++ b/lib/facter/os_package_type.rb @@ -12,17 +12,18 @@ # # In all other cases, we can consider that we're using vanilia (ie: unmodified) # distribution packages, and we can set $::os_package_type depending on the -# value of $::operatingsystem. +# value of $::os['name'] # # Having the below snipets helps simplifying checks within individual project # manifests, so that we can just reuse $::os_package_type directly without # having to also check if it contains a value, then check for the content of -# $::operatingsystem (ie: what's below factors the check once and for all). +# $::os['family'] (ie: what's below factors the check once and for all). Facter.add('os_package_type') do setcode do - case Facter.value(:osfamily) + os = Facter.value(:os) + case os['family'] when 'Debian' - if Facter.value(:operatingsystem) == 'Debian' then + if os['name'] == 'Debian' then 'debian' else 'ubuntu'