Sha256: 3487729053386e4b6c0e161807d43adbb752b918b5806767996aacd47e63ce55

Contents?: true

Size: 1.02 KB

Versions: 32

Compression:

Stored size: 1.02 KB

Contents

module Specinfra
  class HostInventory
    class Virtualization < Base
      def get
        res = {}
        if backend.run_command('ls /.dockerinit').success?
          res[:system] = 'docker'
          return res
        end

        if backend.run_command('ls /usr/sbin/dmidecode').success?
          ret = backend.run_command('dmidecode')
          if ret.exit_status == 0
            case ret.stdout
            when /Manufacturer: VMware/
              if ret.stdout =~ /Product Name: VMware Virtual Platform/
                res[:system] = 'vmware'
              end
            when /Manufacturer: Oracle Corporation/
              if ret.stdout =~ /Product Name: VirtualBox/
                res[:system] = 'vbox'
              end
            when /Product Name: KVM/
              res[:system] = 'kvm'
            when /Product Name: OpenStack/
              res[:system] = 'openstack'
            else
              nil
            end
          else
            nil
          end
        end

        res
      end
    end
  end
end

Version data entries

32 entries across 32 versions & 2 rubygems

Version Path
specinfra-cisco-2.41.0 lib/specinfra/host_inventory/virtualization.rb
specinfra-2.43.11 lib/specinfra/host_inventory/virtualization.rb
specinfra-cisco-2.40.2 lib/specinfra/host_inventory/virtualization.rb
specinfra-2.43.10 lib/specinfra/host_inventory/virtualization.rb
specinfra-2.43.9 lib/specinfra/host_inventory/virtualization.rb
specinfra-2.43.8 lib/specinfra/host_inventory/virtualization.rb
specinfra-2.43.7 lib/specinfra/host_inventory/virtualization.rb
specinfra-2.43.6 lib/specinfra/host_inventory/virtualization.rb
specinfra-2.43.5 lib/specinfra/host_inventory/virtualization.rb
specinfra-2.43.4 lib/specinfra/host_inventory/virtualization.rb
specinfra-2.43.3 lib/specinfra/host_inventory/virtualization.rb
specinfra-2.43.2 lib/specinfra/host_inventory/virtualization.rb
specinfra-2.43.1 lib/specinfra/host_inventory/virtualization.rb
specinfra-2.43.0 lib/specinfra/host_inventory/virtualization.rb
specinfra-2.42.2 lib/specinfra/host_inventory/virtualization.rb
specinfra-2.42.1 lib/specinfra/host_inventory/virtualization.rb
specinfra-2.42.0 lib/specinfra/host_inventory/virtualization.rb
specinfra-2.41.1 lib/specinfra/host_inventory/virtualization.rb
specinfra-2.41.0 lib/specinfra/host_inventory/virtualization.rb
specinfra-2.40.2 lib/specinfra/host_inventory/virtualization.rb