diff options
Diffstat (limited to 'plugins/facter')
-rw-r--r-- | plugins/facter/virtual.rb | 39 | ||||
-rw-r--r-- | plugins/facter/vserver.rb | 29 | ||||
-rw-r--r-- | plugins/facter/xen.rb | 12 |
3 files changed, 0 insertions, 80 deletions
diff --git a/plugins/facter/virtual.rb b/plugins/facter/virtual.rb deleted file mode 100644 index afb60f3..0000000 --- a/plugins/facter/virtual.rb +++ /dev/null @@ -1,39 +0,0 @@ -# Copied from http://reductivelabs.com/trac/puppet/wiki/VirtualRecipe?version=6 -# Authored by abnormaliti with contributions by daniel@nsp.co.nz and mwr - -# This defines the fact "virtual" with the possible values of "physical", -# "vmware", "vmware_server", "xenu", or "xen0" - -Facter.add("virtual") do - confine :kernel => :linux - - ENV["PATH"]="/bin:/sbin:/usr/bin:/usr/sbin" - - result = "physical" - - setcode do - - lspciexists = system "which lspci > /dev/null 2>&1" - if $?.exitstatus == 0 - output = %x{lspci} - output.each {|p| - # --- look for the vmware video card to determine if it is virtual => vmware. - # --- 00:0f.0 VGA compatible controller: VMware Inc [VMware SVGA II] PCI Display Adapter - result = "vmware" if p =~ /VMware/ - } - end - - # VMware server 1.0.3 rpm places vmware-vmx in this place, other versions or platforms may not. - if FileTest.exists?("/usr/lib/vmware/bin/vmware-vmx") - result = "vmware_server" - end - - if FileTest.exists?("/proc/xen/capabilities") and File.read("/proc/xen/capabilities") =~ /control_d/i - result = "xen0" - elsif FileTest.exists?("/proc/sys/xen/independent_wallclock") - result = "xenu" - end - result - end -end - diff --git a/plugins/facter/vserver.rb b/plugins/facter/vserver.rb deleted file mode 100644 index bd8218d..0000000 --- a/plugins/facter/vserver.rb +++ /dev/null @@ -1,29 +0,0 @@ -# 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 - diff --git a/plugins/facter/xen.rb b/plugins/facter/xen.rb deleted file mode 100644 index 0ea8fa2..0000000 --- a/plugins/facter/xen.rb +++ /dev/null @@ -1,12 +0,0 @@ -# xen.rb -- linux-vserver.org related facts -# Copyright (C) 2008 Puzzle ITC -# See LICENSE for the full license granted to you. - -Facter.add("xen_domains") do - confine :virtual => :xen0 - ENV["PATH"]="/bin:/sbin:/usr/bin:/usr/sbin" - setcode do - %x{xm list | egrep -v '(^Name|^Domain-0)' | wc -l}.chomp - end -end - |