From: Stephen Gran Date: Sat, 28 Feb 2009 19:25:12 +0000 (+0000) Subject: Another shot at this facts thing X-Git-Url: https://git.adam-barratt.org.uk/?p=mirror%2Fdsa-puppet.git;a=commitdiff_plain;h=7119e520e83510aa45affaecd9da898d0acb3010 Another shot at this facts thing Signed-off-by: Stephen Gran --- diff --git a/facts/raidcontroller.rb b/facts/raidcontroller.rb new file mode 100644 index 000000000..5ec322ace --- /dev/null +++ b/facts/raidcontroller.rb @@ -0,0 +1,15 @@ +Facter.add("raidcontroller") do + confine :kernel => :linux + ENV["PATH"]="/bin:/sbin:/usr/bin:/usr/sbin" + setcode do + controllers = [] + lspciexists = system "/bin/bash -c 'which lspci >&/dev//null'" + if $?.exitstatus == 0 + output = %x{lspci} + output.each { |s| + controllers.push($1) if s =~ /RAID bus controller: (.*)/ + } + end + controllers + end +end diff --git a/fileserver.conf b/fileserver.conf index dfb950b49..8aab99c29 100644 --- a/fileserver.conf +++ b/fileserver.conf @@ -15,3 +15,6 @@ # allow *.example.com # deny *.evil.example.com # allow 192.168.0.0/24 +[facts] + path /etc/puppet/facts + diff --git a/plugins/facter/raidcontroller.rb b/plugins/facter/raidcontroller.rb deleted file mode 100644 index 5ec322ace..000000000 --- a/plugins/facter/raidcontroller.rb +++ /dev/null @@ -1,15 +0,0 @@ -Facter.add("raidcontroller") do - confine :kernel => :linux - ENV["PATH"]="/bin:/sbin:/usr/bin:/usr/sbin" - setcode do - controllers = [] - lspciexists = system "/bin/bash -c 'which lspci >&/dev//null'" - if $?.exitstatus == 0 - output = %x{lspci} - output.each { |s| - controllers.push($1) if s =~ /RAID bus controller: (.*)/ - } - end - controllers - end -end