Sha256: 7a80813dedb4a31061ec2af6f5878d5c9f0951c2219d79a3f9f32a15972ed2da

Contents?: true

Size: 868 Bytes

Versions: 7

Compression:

Stored size: 868 Bytes

Contents

# frozen_string_literal: true

module Facts
  module Aix
    class Disks
      FACT_NAME = 'disks'
      ALIASES = %w[blockdevices blockdevice_.*_size'].freeze

      def call_the_resolver
        facts = []
        disks = Facter::Resolvers::Aix::Disks.resolve(:disks)

        return Facter::ResolvedFact.new(FACT_NAME, nil) if disks.nil? || disks.empty?

        blockdevices = disks.keys.join(',')
        facts.push(Facter::ResolvedFact.new(FACT_NAME, disks))
        facts.push(Facter::ResolvedFact.new('blockdevices', blockdevices, :legacy))
        add_legacy_facts(disks, facts)

        facts
      end

      private

      def add_legacy_facts(disks, facts)
        disks.each do |disk_name, disk_info|
          facts.push(Facter::ResolvedFact.new("blockdevice_#{disk_name}_size", disk_info[:size_bytes], :legacy))
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
facter-4.0.47 lib/facter/facts/aix/disks.rb
facter-4.0.46 lib/facter/facts/aix/disks.rb
facter-4.0.44 lib/facter/facts/aix/disks.rb
facter-4.0.43 lib/facter/facts/aix/disks.rb
facter-4.0.42 lib/facter/facts/aix/disks.rb
facter-4.0.41 lib/facter/facts/aix/disks.rb
facter-4.0.40 lib/facter/facts/aix/disks.rb