403Webshell
Server IP : 172.67.158.161  /  Your IP : 18.225.255.168
Web Server : LiteSpeed
System : Linux business53.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64
User : giankuin ( 1871)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/util/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/util//file_helper.rb
# frozen_string_literal: true

module Facter
  module Util
    class FileHelper
      @log = Log.new(self)

      class << self
        DEBUG_MESSAGE = 'File at: %s is not accessible.'

        def safe_read(path, default_return = '')
          return File.read(path, encoding: Encoding::UTF_8) if File.readable?(path)

          log_failed_to_read(path)
          default_return
        end

        # rubocop:disable Style/SpecialGlobalVars
        def safe_readlines(path, default_return = [], sep = $/, chomp: false)
          return File.readlines(path, sep, chomp: chomp, encoding: Encoding::UTF_8) if File.readable?(path)

          log_failed_to_read(path)
          default_return
        end
        # rubocop:enable Style/SpecialGlobalVars

        # This previously acted as a helper method for versions of Ruby older
        # than 2.5, before Dir.children was added. As it isn't a private
        # method, we can't remove it entirely until the next major Facter
        # release (presumably Facter 5).
        def dir_children(path)
          Dir.children(path)
        end

        private

        def log_failed_to_read(path)
          @log.debug(DEBUG_MESSAGE % path)
        end
      end
    end
  end
end

Youez - 2016 - github.com/yon3zu
LinuXploit