Class: Facts::Linux::Ec2Userdata

Inherits:
Object
  • Object
show all
Defined in:
lib/facter/facts/linux/ec2_userdata.rb

Constant Summary collapse

FACT_NAME =
'ec2_userdata'

Instance Method Summary collapse

Constructor Details

#initializeEc2Userdata

Returns a new instance of Ec2Userdata.



8
9
10
# File 'lib/facter/facts/linux/ec2_userdata.rb', line 8

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

Instance Method Details

#call_the_resolverObject



12
13
14
15
16
17
18
# File 'lib/facter/facts/linux/ec2_userdata.rb', line 12

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