blob: bd8218d465b1f5530b826424f432e6fc8a112fa0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# vserver.rb -- linux-vserver.org related facts
# Copyright (C) 2007 David Schmitt <david@schmitt.edv-bus.at>
# See LICENSE for the full license granted to you.
# Based on abnormaliti's "virtual" fact from
# http://reductivelabs.com/trac/puppet/wiki/VirtualRecipe
# This defines the fact "vserver" with the possible values of "none", "guest",
# or "host"
Facter.add("vserver") do
confine :kernel => :linux
ENV["PATH"]="/bin:/sbin:/usr/bin:/usr/sbin"
result = "none"
setcode do
if FileTest.directory?('/proc/virtual')
result = "host"
elsif ! FileTest.directory?('/proc/2')
# gross hack: PID 2 is usually a
# kernel thread, which doesn't existin vserver
result = "guest"
end
result
end
end
|