Sha256: 18734c751c8b729c72802d064b8ff296617b7b58272668c23d7f42e11b8ae377

Contents?: true

Size: 874 Bytes

Versions: 10

Compression:

Stored size: 874 Bytes

Contents

# frozen_string_literal: true

module Facter
  module Resolvers
    module Solaris
      class ZPool < BaseResolver
        @log = Facter::Log.new(self)
        @semaphore = Mutex.new
        @fact_list ||= {}
        class << self
          private

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

          def zpool_fact(fact_name)
            build_zpool_facts
            @fact_list[fact_name]
          end

          def build_zpool_facts
            output, _status = Open3.capture2('zpool upgrade -v')
            features_list = output.scan(/^\s+(\d+)/).flatten

            return if features_list.empty?

            @fact_list[:zpool_featurenumbers] = features_list.join(',')
            @fact_list[:zpool_version] = features_list.last
          end
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
facter-4.0.17 lib/resolvers/solaris/zpool_resolver.rb
facter-4.0.16 lib/resolvers/solaris/zpool_resolver.rb
facter-4.0.15 lib/resolvers/solaris/zpool_resolver.rb
facter-4.0.14 lib/resolvers/solaris/zpool_resolver.rb
facter-4.0.13 lib/resolvers/solaris/zpool_resolver.rb
facter-4.0.12 lib/resolvers/solaris/zpool_resolver.rb
facter-4.0.11 lib/resolvers/solaris/zpool_resolver.rb
facter-4.0.10.pre lib/resolvers/solaris/zpool_resolver.rb
facter-4.0.9.pre lib/resolvers/solaris/zpool_resolver.rb
facter-4.0.8.pre lib/resolvers/solaris/zpool_resolver.rb