Sha256: ae97a07ba62ea0b81d7d577a8c19ca820dfcda81f3a559d616e749aa0cbcd905

Contents?: true

Size: 766 Bytes

Versions: 15

Compression:

Stored size: 766 Bytes

Contents

# frozen_string_literal: true

module Facts
  module Windows
    module Cloud
      class Provider
        FACT_NAME = 'cloud.provider'

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

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

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
facter-4.6.1 lib/facter/facts/windows/cloud/provider.rb
facter-4.6.0 lib/facter/facts/windows/cloud/provider.rb
facter-4.5.2 lib/facter/facts/windows/cloud/provider.rb
facter-4.5.1 lib/facter/facts/windows/cloud/provider.rb
facter-4.5.0 lib/facter/facts/windows/cloud/provider.rb
facter-4.4.3 lib/facter/facts/windows/cloud/provider.rb
facter-4.4.2 lib/facter/facts/windows/cloud/provider.rb
facter-4.4.1 lib/facter/facts/windows/cloud/provider.rb
facter-4.4.0 lib/facter/facts/windows/cloud/provider.rb
facter-4.3.1 lib/facter/facts/windows/cloud/provider.rb
facter-4.3.0 lib/facter/facts/windows/cloud/provider.rb
facter-4.2.14 lib/facter/facts/windows/cloud/provider.rb
facter-4.2.13 lib/facter/facts/windows/cloud/provider.rb
facter-4.2.12 lib/facter/facts/windows/cloud/provider.rb
facter-4.2.11 lib/facter/facts/windows/cloud/provider.rb