Sha256: 85bb95f731352716defbcbf592424e5cc032256efc6e4b894eb6a175ffd1d13f

Contents?: true

Size: 581 Bytes

Versions: 3

Compression:

Stored size: 581 Bytes

Contents

# frozen_string_literal: true

module Facts
  module Linux
    class AzMetadata
      FACT_NAME = 'az_metadata'

      def initialize
        @virtual = Facter::Util::Facts::VirtualDetector.new
      end

      def call_the_resolver
        return Facter::ResolvedFact.new(FACT_NAME, nil) unless azure_hypervisor?

        fact_value = Facter::Resolvers::Az.resolve(:metadata)

        Facter::ResolvedFact.new(FACT_NAME, fact_value&.empty? ? nil : fact_value)
      end

      private

      def azure_hypervisor?
        @virtual.platform == 'hyperv'
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
facter-4.1.1 lib/facter/facts/linux/az_metadata.rb
facter-4.1.0 lib/facter/facts/linux/az_metadata.rb
facter-4.0.52 lib/facter/facts/linux/az_metadata.rb