Sha256: 920b56f10550e43e5a8dbca4f4abbfbcfcd76b5c562aeea24984b5c421c2bfc2

Contents?: true

Size: 530 Bytes

Versions: 8

Compression:

Stored size: 530 Bytes

Contents

# frozen_string_literal: true

module Facts
  module Windows
    class Ec2Metadata
      FACT_NAME = 'ec2_metadata'

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

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

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

      def aws?
        virtual = Facter::Resolvers::Virtualization.resolve(:virtual)

        virtual == 'kvm' || virtual =~ /xen/
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
facter-4.0.35 lib/facter/facts/windows/ec2_metadata.rb
facter-4.0.34 lib/facter/facts/windows/ec2_metadata.rb
facter-4.0.33 lib/facter/facts/windows/ec2_metadata.rb
facter-4.0.32 lib/facter/facts/windows/ec2_metadata.rb
facter-4.0.31 lib/facter/facts/windows/ec2_metadata.rb
facter-4.0.30 lib/facter/facts/windows/ec2_metadata.rb
facter-4.0.29 lib/facts/windows/ec2_metadata.rb
facter-4.0.28 lib/facts/windows/ec2_metadata.rb