Sha256: 6c5791009d9db29836272456d92d7dc5f7921cf116b4742b8c7d99956775a474

Contents?: true

Size: 953 Bytes

Versions: 1

Compression:

Stored size: 953 Bytes

Contents

module Specinfra
  class HostInventory
    class Virtualization < Base
      def get
        res = {}
        if backend.run_command('ls /.dockerinit').success?
          res[:system] = 'docker'
        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: OpenStack/
              res[:system] = 'openstack'
            else
              nil
            end
          else
            nil
          end
        end

        res
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
specinfra-2.37.2 lib/specinfra/host_inventory/virtualization.rb