[Pkg-puppet-devel] [facter] 120/180: (FACT-484) check dmi sysfs file for readability instead of just existence

Stig Sandbeck Mathisen ssm at debian.org
Mon Jun 30 15:06:38 UTC 2014


This is an automated email from the git hooks/post-receive script.

ssm pushed a commit to branch master
in repository facter.

commit 1f69ebfb15c1019eef489db4e294322021bcaf96
Author: Felix Frank <Felix.Frank at Alumni.TU-Berlin.de>
Date:   Sun May 25 23:41:17 2014 +0200

    (FACT-484) check dmi sysfs file for readability instead of just existence
    
    Retrieving the virtual fact without root privileges would yield
    warning messages due to missing permissions on
    /sys/firmware/dmi/entries/1-0/raw (at least on certain versions of Debian).
    
    The readable? query makes more sense than exists? at this point, anyway.
---
 lib/facter/util/virtual.rb | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/facter/util/virtual.rb b/lib/facter/util/virtual.rb
index 12bc454..d98e720 100644
--- a/lib/facter/util/virtual.rb
+++ b/lib/facter/util/virtual.rb
@@ -167,9 +167,9 @@ module Facter::Util::Virtual
   #
   # @api public
   #
-  # @return [String] or nil if the path does not exist
+  # @return [String] or nil if the path does not exist or is unreadable
   def self.read_sysfs_dmi_entries(path="/sys/firmware/dmi/entries/1-0/raw")
-    if File.exists?(path)
+    if File.readable?(path)
       Facter::Util::FileRead.read_binary(path)
     end
   end

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-puppet/facter.git



More information about the Pkg-puppet-devel mailing list