Module Facter::Util::Virtual
In: lib/facter/util/virtual.rb

Methods

Public Class methods

docker? returns true if the process is running inside of a docker container. Implementation derived from observation of a boot2docker system

lspci is a delegating helper method intended to make it easier to stub the system call without affecting other calls to Facter::Core::Execution.exec

lxc? returns true if the process is running inside of a linux container. Implementation derived from stackoverflow.com/questions/20010199/determining-if-a-process-runs-inside-lxc-docker

Cloudlinux uses OpenVZ to a degree, but always has an empty /proc/vz/ and has /proc/lve/list present

So one can either have 6728 work on OpenVZ or Cloudlinux. Whoo.

read_sysfs Reads the raw data as per the documentation at [Detecting if You Are Running in Google Compute Engine](developers.google.com/compute/docs/instances#dmi) This method is intended to provide an easy seam to mock.

@api public

@return [String] or nil if the path does not exist or is unreadable

virt_what is a delegating helper method intended to make it easier to stub the system call without affecting other calls to Facter::Core::Execution.exec

Per bugzilla.redhat.com/show_bug.cgi?id=719611 when run as a non-root user the virt-what command may emit an error message on stdout, and later versions of virt-what may emit this message on stderr. This method ensures stderr is redirected and that error messages are stripped from stdout.

[Validate]