lib/facter/selinux.rb in facter-1.6.10 vs lib/facter/selinux.rb in facter-1.6.11

- old
+ new

@@ -13,19 +13,20 @@ sestatus_cmd = '/usr/sbin/sestatus' # This supports the fact that the selinux mount point is not always in the # same location -- the selinux mount point is operating system specific. def selinux_mount_point - if FileTest.exists?('/proc/self/mountinfo') - File.open('/proc/self/mountinfo') do |f| + path = "/selinux" + if FileTest.exists?('/proc/self/mounts') + File.open('/proc/self/mounts') do |f| f.grep(/selinuxfs/) do |line| - line.split[4] + path = line.split[1] + break end end - else - "/selinux" end + path end Facter.add("selinux") do confine :kernel => :linux setcode do @@ -54,10 +55,14 @@ end Facter.add("selinux_policyversion") do confine :selinux => :true setcode do - File.read("#{selinux_mount_point}/policyvers") + result = 'unknown' + if FileTest.exists?("#{selinux_mount_point}/policyvers") + result = File.read("#{selinux_mount_point}/policyvers").chomp + end + result end end Facter.add("selinux_current_mode") do confine :selinux => :true