Sha256: b90f09f3d47bbc5e99a63c2e8cfe4b9b00ee399d964e8c7f6f8c2ecf26608124

Contents?: true

Size: 1.02 KB

Versions: 40

Compression:

Stored size: 1.02 KB

Contents

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

        ## OpenVZ on Linux 
        if backend.run_command('test -d /proc/vz -a ! -d /proc/bc').success?
          res[:system] = 'openvz'
          return res
        end

        cmd = backend.command.get(:get_inventory_system_product_name)
        ret = backend.run_command(cmd)
        if ret.exit_status == 0
           res[:system] = parse_system_product_name(ret.stdout)   
        end 

        res 
      end 

      def parse_system_product_name(ret)
        product_name = case ret
          when /.*VMware Virtual Platform/
            'vmware'
          when /.*VirtualBox/
            'vbox'
          when /.*KVM/
            'kvm'
          when /.*OpenStack/
            'openstack'
          else
            nil
        end
        product_name
      end

    end
  end
end

Version data entries

40 entries across 40 versions & 2 rubygems

Version Path
specinfra-rb19-2.44.7 lib/specinfra/host_inventory/virtualization.rb
specinfra-2.58.0 lib/specinfra/host_inventory/virtualization.rb
specinfra-2.57.5 lib/specinfra/host_inventory/virtualization.rb
specinfra-2.57.4 lib/specinfra/host_inventory/virtualization.rb
specinfra-2.57.3 lib/specinfra/host_inventory/virtualization.rb
specinfra-2.57.2 lib/specinfra/host_inventory/virtualization.rb
specinfra-2.57.1 lib/specinfra/host_inventory/virtualization.rb
specinfra-2.57.0 lib/specinfra/host_inventory/virtualization.rb
specinfra-2.56.1 lib/specinfra/host_inventory/virtualization.rb
specinfra-2.56.0 lib/specinfra/host_inventory/virtualization.rb
specinfra-2.55.0 lib/specinfra/host_inventory/virtualization.rb
specinfra-2.54.2 lib/specinfra/host_inventory/virtualization.rb
specinfra-2.54.1 lib/specinfra/host_inventory/virtualization.rb
specinfra-2.54.0 lib/specinfra/host_inventory/virtualization.rb
specinfra-2.53.1 lib/specinfra/host_inventory/virtualization.rb
specinfra-2.53.0 lib/specinfra/host_inventory/virtualization.rb
specinfra-2.52.0 lib/specinfra/host_inventory/virtualization.rb
specinfra-2.51.2 lib/specinfra/host_inventory/virtualization.rb
specinfra-2.51.1 lib/specinfra/host_inventory/virtualization.rb
specinfra-2.51.0 lib/specinfra/host_inventory/virtualization.rb