Sha256: 8600703a12092613e19bde6351b8b69d705a2987b0124b128f13ddfbb18b6451

Contents?: true

Size: 574 Bytes

Versions: 5

Compression:

Stored size: 574 Bytes

Contents

# frozen_string_literal: true

module Facts
  module Linux
    class Ec2Userdata
      FACT_NAME = 'ec2_userdata'

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

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

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

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

      private

      def aws_hypervisors?
        @virtual.platform =~ /kvm|xen|aws/
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
facter-4.0.46 lib/facter/facts/linux/ec2_userdata.rb
facter-4.0.44 lib/facter/facts/linux/ec2_userdata.rb
facter-4.0.43 lib/facter/facts/linux/ec2_userdata.rb
facter-4.0.42 lib/facter/facts/linux/ec2_userdata.rb
facter-4.0.41 lib/facter/facts/linux/ec2_userdata.rb