Sha256: ef5fab833284663c9e739033488c82a1387da07dbb9bfd4ecdb24da3e8408cee

Contents?: true

Size: 1.29 KB

Versions: 14

Compression:

Stored size: 1.29 KB

Contents

# frozen_string_literal: true

module Facter
  module Resolvers
    class Architecture < BaseResolver
      # :architecture
      init_resolver

      class << self
        private

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

        def read_architecture(fact_name)
          require_relative '../../../facter/util/aix/odm_query'

          proc_number = read_proc
          odmquery = Facter::Util::Aix::ODMQuery.new
          odmquery
            .equals('name', proc_number)
            .equals('attribute', 'type')

          result = odmquery.execute

          return unless result

          result.each_line do |line|
            if line.include?('value')
              @fact_list[:architecture] = line.split('=')[1].strip.delete('\"')
              break
            end
          end

          @fact_list[fact_name]
        end

        def read_proc
          odmquery = Facter::Util::Aix::ODMQuery.new
          odmquery
            .equals('PdDvLn', 'processor/sys/proc_rspc')
            .equals('status', '1')

          result = odmquery.execute
          result.each_line do |line|
            return line.split('=')[1].strip.delete('\"') if line.include?('name')
          end
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
facter-4.10.0 lib/facter/resolvers/aix/architecture.rb
facter-4.9.0 lib/facter/resolvers/aix/architecture.rb
facter-4.8.0 lib/facter/resolvers/aix/architecture.rb
facter-4.7.1 lib/facter/resolvers/aix/architecture.rb
facter-4.7.0 lib/facter/resolvers/aix/architecture.rb
facter-4.6.1 lib/facter/resolvers/aix/architecture.rb
facter-4.6.0 lib/facter/resolvers/aix/architecture.rb
facter-4.5.2 lib/facter/resolvers/aix/architecture.rb
facter-4.5.1 lib/facter/resolvers/aix/architecture.rb
facter-4.5.0 lib/facter/resolvers/aix/architecture.rb
facter-4.4.3 lib/facter/resolvers/aix/architecture.rb
facter-4.4.2 lib/facter/resolvers/aix/architecture.rb
facter-4.4.1 lib/facter/resolvers/aix/architecture.rb
facter-4.4.0 lib/facter/resolvers/aix/architecture.rb