Sha256: c5aef24b7c5ab1e8228fa6d9c072d8f3f350f41e5445a37a87254b13459d0ed0

Contents?: true

Size: 525 Bytes

Versions: 2

Compression:

Stored size: 525 Bytes

Contents

# frozen_string_literal: true

module Facts
  module Windows
    class AzMetadata
      FACT_NAME = 'az_metadata'

      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?
        Facter::Resolvers::Virtualization.resolve(:virtual) == 'hyperv'
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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