Sha256: 94440a6af037148184ab9b74e17ee1d480bfd549bacf5a6c8105aabae7e1575f

Contents?: true

Size: 1.03 KB

Versions: 1

Compression:

Stored size: 1.03 KB

Contents

module Facter::Util::Virtual
    def self.openvz?
        FileTest.exists?("/proc/vz/veinfo")
    end

    def self.openvz_type
        return nil unless self.openvz?
        if FileTest.exists?("/proc/vz/version")
            result = "openvzhn"
        else
            result = "openvzve"
        end
    end

    def self.zone?
        z = Facter::Util::Resolution.exec("/sbin/zonename")
        return false unless z
        return z.chomp != 'global'
    end

    def self.vserver?
        return false unless FileTest.exists?("/proc/self/status")
        txt = File.read("/proc/self/status")
        return true if txt =~ /^(s_context|VxID):[[:blank:]]*[1-9]/
        return false
    end

    def self.vserver_type
        if self.vserver?
            if FileTest.exists?("/proc/virtual")
                "vserver_host"
            else
                "vserver"
            end
        end
    end

    def self.xen?
        ["/proc/sys/xen", "/sys/bus/xen", "/proc/xen" ].detect do |f|
            FileTest.exists?(f)
        end
    end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
facter-1.5.7 lib/facter/util/virtual.rb