Sha256: e427aa0945f06972f1856cf50e7c08116fd9f3bdc0d772a39f78871d6de1e210

Contents?: true

Size: 587 Bytes

Versions: 8

Compression:

Stored size: 587 Bytes

Contents

# frozen_string_literal: true

module Facts
  module Linux
    class Ec2Userdata
      FACT_NAME = 'ec2_userdata'

      def initialize
        @virtual = Facter::Util::Facts::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

8 entries across 8 versions & 1 rubygems

Version Path
facter-4.1.1 lib/facter/facts/linux/ec2_userdata.rb
facter-4.1.0 lib/facter/facts/linux/ec2_userdata.rb
facter-4.0.52 lib/facter/facts/linux/ec2_userdata.rb
facter-4.0.51 lib/facter/facts/linux/ec2_userdata.rb
facter-4.0.50 lib/facter/facts/linux/ec2_userdata.rb
facter-4.0.49 lib/facter/facts/linux/ec2_userdata.rb
facter-4.0.48 lib/facter/facts/linux/ec2_userdata.rb
facter-4.0.47 lib/facter/facts/linux/ec2_userdata.rb