Sha256: 720eb9c163e7c4f33311995d8ae9ccc9029f6fa3cd60dbc737be2ed0819f3bb5

Contents?: true

Size: 1.07 KB

Versions: 15

Compression:

Stored size: 1.07 KB

Contents

# frozen_string_literal: true

module Facter
  module Resolvers
    class Uname < BaseResolver
      @semaphore = Mutex.new
      @fact_list ||= {}

      class << self
        private

        def post_resolve(fact_name)
          @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

15 entries across 15 versions & 1 rubygems

Version Path
facter-4.0.36 lib/facter/resolvers/uname_resolver.rb
facter-4.0.35 lib/facter/resolvers/uname_resolver.rb
facter-4.0.34 lib/facter/resolvers/uname_resolver.rb
facter-4.0.33 lib/facter/resolvers/uname_resolver.rb
facter-4.0.32 lib/facter/resolvers/uname_resolver.rb
facter-4.0.31 lib/facter/resolvers/uname_resolver.rb
facter-4.0.30 lib/facter/resolvers/uname_resolver.rb
facter-4.0.29 lib/resolvers/uname_resolver.rb
facter-4.0.28 lib/resolvers/uname_resolver.rb
facter-4.0.26 lib/resolvers/uname_resolver.rb
facter-4.0.25 lib/resolvers/uname_resolver.rb
facter-4.0.24 lib/resolvers/uname_resolver.rb
facter-4.0.23 lib/resolvers/uname_resolver.rb
facter-4.0.22 lib/resolvers/uname_resolver.rb
facter-4.0.21 lib/resolvers/uname_resolver.rb