Sha256: c4925f0be9d3c96c177791b31927a5de1bf2f20de045828855365d75edb05f00

Contents?: true

Size: 1.05 KB

Versions: 28

Compression:

Stored size: 1.05 KB

Contents

# frozen_string_literal: true

module Facter
  module Resolvers
    class Uname < BaseResolver
      init_resolver

      class << self
        private

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

        def uname_system_call(fact_name)
          output = Facter::Core::Execution.execute('uname -m &&
            uname -n &&
            uname -p &&
            uname -r &&
            uname -s &&
            uname -v', logger: log)

          build_fact_list(output)

          @fact_list[fact_name]
        end

        def build_fact_list(output)
          uname_results = output.split("\n")

          @fact_list[:machine] = uname_results[0].strip
          @fact_list[:nodename] = uname_results[1].strip
          @fact_list[:processor] = uname_results[2].strip
          @fact_list[:kernelrelease] = uname_results[3].strip
          @fact_list[:kernelname] = uname_results[4].strip
          @fact_list[:kernelversion] = uname_results[5].strip
        end
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
facter-4.5.1 lib/facter/resolvers/uname.rb
facter-4.5.0 lib/facter/resolvers/uname.rb
facter-4.4.3 lib/facter/resolvers/uname.rb
facter-4.4.2 lib/facter/resolvers/uname.rb
facter-4.4.1 lib/facter/resolvers/uname.rb
facter-4.4.0 lib/facter/resolvers/uname.rb
facter-4.3.1 lib/facter/resolvers/uname.rb
facter-4.3.0 lib/facter/resolvers/uname.rb
facter-4.2.14 lib/facter/resolvers/uname.rb
facter-4.2.13 lib/facter/resolvers/uname.rb
facter-4.2.12 lib/facter/resolvers/uname.rb
facter-4.2.11 lib/facter/resolvers/uname.rb
facter-4.2.10 lib/facter/resolvers/uname.rb
facter-4.2.9 lib/facter/resolvers/uname.rb
facter-4.2.8 lib/facter/resolvers/uname.rb
facter-4.2.7 lib/facter/resolvers/uname.rb
facter-4.2.6 lib/facter/resolvers/uname.rb
facter-4.2.5 lib/facter/resolvers/uname.rb
facter-4.2.4 lib/facter/resolvers/uname.rb
facter-4.2.3 lib/facter/resolvers/uname.rb