Sha256: 22cba3747178a2090fee5d5b785d38be87426055fa46eba4a33316f174e0a192

Contents?: true

Size: 885 Bytes

Versions: 6

Compression:

Stored size: 885 Bytes

Contents

# frozen_string_literal: true

module Facter
  module Resolvers
    module Linux
      class Filesystems < BaseResolver
        # :systems
        @semaphore = Mutex.new
        @fact_list ||= {}
        @log = Facter::Log.new(self)
        class << self
          private

          def post_resolve(fact_name)
            @fact_list.fetch(fact_name) { read_filesystems(fact_name) }
          end

          def read_filesystems(fact_name)
            return unless File.readable?('/proc/filesystems')

            output = File.read('/proc/filesystems')
            filesystems = []
            output.each_line do |line|
              tokens = line.split(' ')
              filesystems << tokens if tokens.size == 1
            end
            @fact_list[:systems] = filesystems.sort.join(',')
            @fact_list[fact_name]
          end
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
facter-4.0.15 lib/resolvers/filesystems_resolver.rb
facter-4.0.14 lib/resolvers/filesystems_resolver.rb
facter-4.0.13 lib/resolvers/filesystems_resolver.rb
facter-4.0.12 lib/resolvers/filesystems_resolver.rb
facter-4.0.11 lib/resolvers/filesystems_resolver.rb
facter-4.0.10.pre lib/resolvers/filesystems_resolver.rb