Class: Facts::Windows::Cloud::Provider

Inherits:
Object
  • Object
show all
Defined in:
lib/facter/facts/windows/cloud/provider.rb

Constant Summary collapse

FACT_NAME =
'cloud.provider'

Instance Method Summary collapse

Instance Method Details

#call_the_resolverObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/facter/facts/windows/cloud/provider.rb', line 9

def call_the_resolver
  virtual = Facter::Resolvers::Windows::Virtualization.resolve(:virtual)
  provider = case virtual
             when 'hyperv'
                = Facter::Resolvers::Az.resolve(:metadata)
               'azure' unless .nil? || .empty?
             when 'kvm', 'xen'
                = Facter::Resolvers::Ec2.resolve(:metadata)
               'aws' unless .nil? || .empty?
             when 'gce'
                = Facter::Resolvers::Gce.resolve(:metadata)
               'gce' unless .nil? || .empty?
             end

  Facter::ResolvedFact.new(FACT_NAME, provider)
end