PK œqhYî¶J‚ßFßF)nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/ $#$#$#

Dir : /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/resolvers/solaris/
Server: Linux server1.ngambekcore.com 4.18.0-553.51.1.el8_10.x86_64 #1 SMP Wed Apr 30 04:00:07 EDT 2025 x86_64
IP: 159.198.77.92
Choose File :

Url:
Dir : //opt/puppetlabs/puppet/lib/ruby/vendor_ruby/facter/resolvers/solaris/dmi_sparc.rb

# frozen_string_literal: true

module Facter
  module Resolvers
    module Solaris
      class DmiSparc < BaseResolver
        init_resolver

        class << self
          private

          def post_resolve(fact_name, _options)
            @fact_list.fetch(fact_name) { read_facts(fact_name) }
          end

          def read_facts(fact_name)
            output = exec_prtdiag
            return unless output

            matches = output.match(/System Configuration:\s+(.+?)\s+sun\d+\S+\s+(.+)/)&.captures

            # There are circumstances (e.g. in non-global zones) when prtdiag
            # will return text, but it's an error message or some other string
            # that isn't parsed by the above match/capture. In that case, we
            # simply return.
            return if matches.nil?

            @fact_list[:manufacturer] = matches[0]&.strip
            @fact_list[:product_name] = matches[1]&.strip

            sneep = exec_sneep&.strip
            @fact_list[:serial_number] = sneep

            @fact_list[fact_name]
          end

          def exec_prtdiag
            return unless File.executable?('/usr/sbin/prtdiag')

            Facter::Core::Execution.execute('/usr/sbin/prtdiag', logger: log)
          end

          def exec_sneep
            return unless File.executable?('/usr/sbin/sneep')

            Facter::Core::Execution.execute('/usr/sbin/sneep', logger: log)
          end
        end
      end
    end
  end
end