HEX
Server: Apache
System: Linux dinesh8189 5.15.98-grsec-sharedvalley-2.lc.el8.x86_64 #1 SMP Thu Mar 9 09:07:30 -03 2023 x86_64
User: cgmgerenciamento1 (814285)
PHP: 8.1.26
Disabled: apache_child_terminate,dl,escapeshellarg,escapeshellcmd,exec,link,mail,openlog,passthru,pcntl_alarm,pcntl_exec,pcntl_fork,pcntl_get_last_error,pcntl_getpriority,pcntl_setpriority,pcntl_signal,pcntl_signal_dispatch,pcntl_sigprocmask,pcntl_sigtimedwait,pcntl_sigwaitinfo,pcntl_strerror,pcntl_wait,pcntl_waitpid,pcntl_wexitstatus,pcntl_wifexited,pcntl_wifsignaled,pcntl_wifstopped,pcntl_wstopsig,pcntl_wtermsig,php_check_syntax,php_strip_whitespace,popen,proc_close,proc_open,shell_exec,symlink,system
Upload Files
File: //opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/facter_impl.rb
# frozen_string_literal: true

#
# @api private
# Default Facter implementation that delegates to Facter API
#

module Puppet
  class FacterImpl
    def initialize
      require 'facter'

      setup_logging
    end

    def value(fact_name)
      ::Facter.value(fact_name)
    end

    def add(name, &block)
      ::Facter.add(name, &block)
    end

    def to_hash
      ::Facter.to_hash
    end

    def clear
      ::Facter.clear
    end

    def reset
      ::Facter.reset
    end

    def resolve(options)
      ::Facter.resolve(options)
    end

    def search_external(dirs)
      ::Facter.search_external(dirs)
    end

    def search(*dirs)
      ::Facter.search(*dirs)
    end

    def trace(value)
      ::Facter.trace(value) if ::Facter.respond_to? :trace
    end

    def debugging(value)
      ::Facter.debugging(value) if ::Facter.respond_to?(:debugging)
    end

    def load_external?
      ::Facter.respond_to?(:load_external)
    end

    def load_external(value)
      ::Facter.load_external(value) if self.load_external?
    end

    private

    def setup_logging
      return unless ::Facter.respond_to? :on_message

      ::Facter.on_message do |level, message|
        case level
        when :trace, :debug
          level = :debug
        when :info
          # Same as Puppet
        when :warn
          level = :warning
        when :error
          level = :err
        when :fatal
          level = :crit
        else
          next
        end

        Puppet::Util::Log.create(
          {
            :level => level,
            :source => 'Facter',
            :message => message
          }
        )
        nil
      end
    end
  end
end