end
end
setcode do
- brokenhosts
+ if brokenhosts
+ true
+ else
+ ''
+ end
end
end
Facter.add("v4ips") do
- confine :kernel => :linux
- addrs = []
- if FileTest.exist?("/bin/ip")
- %x{ip addr list}.each do |line|
- next unless line =~ /\s+inet/
- next if line =~ /scope (link|host)/
- if line =~ /\s+inet\s+(\S+)\/\d{1,2} .*/
- addrs << $1
- end
- end
- end
- ret = addrs.join(",")
- if ret.empty?
- ret = 'no'
- end
- setcode do
- ret
- end
+ confine :kernel => :linux
+ addrs = []
+ if FileTest.exist?("/bin/ip")
+ %x{ip addr list}.each do |line|
+ next unless line =~ /\s+inet/
+ next if line =~ /scope (link|host)/
+ if line =~ /\s+inet\s+(\S+)\/\d{1,2} .*/
+ addrs << $1
+ end
+ end
+ end
+ ret = addrs.join(",")
+ if ret.empty?
+ ret = 'no'
+ end
+ setcode do
+ ret
+ end
end
Facter.add("v4ips") do
end
Facter.add("v6ips") do
- confine :kernel => :linux
- addrs = []
- if FileTest.exist?("/bin/ip")
- %x{ip addr list}.each do |line|
- next unless line =~ /\s+inet/
- next if line =~ /scope (link|host)/
- if line =~ /\s+inet6\s+(\S+)\/\d{1,3} .*/
- addrs << $1
- end
- end
- end
- ret = addrs.join(",")
- if ret.empty?
- ret = 'no'
- end
- setcode do
- ret
- end
+ confine :kernel => :linux
+ addrs = []
+ if FileTest.exist?("/bin/ip")
+ %x{ip addr list}.each do |line|
+ next unless line =~ /\s+inet/
+ next if line =~ /scope (link|host)/
+ if line =~ /\s+inet6\s+(\S+)\/\d{1,3} .*/
+ addrs << $1
+ end
+ end
+ end
+ ret = addrs.join(",")
+ if ret.empty?
+ ret = 'no'
+ end
+ setcode do
+ ret
+ end
end
end
Facter.add("exim_ssl_certs") do
- setcode do
- FileTest.exist?("/etc/exim4/ssl/") &&
+ certs = FileTest.exist?("/etc/exim4/ssl/") &&
FileTest.exist?("/etc/exim4/ssl/ca.crl") &&
FileTest.exist?("/etc/exim4/ssl/thishost.crt") &&
FileTest.exist?("/etc/exim4/ssl/ca.crt") &&
FileTest.exist?("/etc/exim4/ssl/thishost.key")
+ setcode do
+ if certs
+ true
+ else
+ ''
+ end
end
end
Facter.add("portforwarder_user_exists") do
setcode do
- result = false
+ result = ''
begin
if Etc.getpwnam('portforwarder')
result = true
Facter.add("smartarraycontroller") do
confine :kernel => :linux
setcode do
- FileTest.exist?("/dev/cciss/")
+ if FileTest.exist?("/dev/cciss/")
+ true
+ else
+ ''
+ end
end
end
Facter.add("ThreeWarecontroller") do
confine :kernel => :linux
setcode do
- is3w = false
+ is3w = ''
if FileTest.exist?("/proc/scsi/scsi")
IO.foreach("/proc/scsi/scsi") { |x|
is3w = true if x =~ /Vendor: 3ware/
Facter.add("megaraid") do
confine :kernel => :linux
setcode do
- FileTest.exist?("/dev/megadev0")
+ if FileTest.exist?("/dev/megadev0")
+ true
+ else
+ ''
+ end
end
end
Facter.add("mptraid") do
confine :kernel => :linux
setcode do
- FileTest.exist?("/dev/mptctl") or FileTest.exist?("/dev/mpt0") or FileTest.exist?("/proc/mpt/summary")
+ if FileTest.exist?("/dev/mptctl") or FileTest.exist?("/dev/mpt0") or FileTest.exist?("/proc/mpt/summary")
+ true
+ else
+ ''
+ end
end
end
Facter.add("aacraid") do
confine :kernel => :linux
setcode do
- FileTest.exist?("/dev/aac0")
+ if FileTest.exist?("/dev/aac0")
+ true
+ else
+ ''
+ end
end
end
Facter.add("swraid") do
confine :kernel => :linux
setcode do
- swraid = false
+ swraid = ''
if FileTest.exist?("/proc/mdstat") && FileTest.exist?("/sbin/mdadm")
IO.foreach("/proc/mdstat") { |x|
swraid = true if x =~ /md[0-9]+ : active/
Facter.add("kvmdomain") do
setcode do
+ result = ''
if File.new('/proc/cpuinfo').read().index('QEMU Virtual CPU')
result = true
- else
- result = false
end
result
end
Facter.add(service + "_host") do
confine :kernel => :linux
service_name = "#{service}." + Facter.domain
- active = false
+ active = ''
setcode do
if FileTest.exist?("/usr/bin/dig")
Facter.add("apache2") do
setcode do
- FileTest.exist?("/usr/sbin/apache2")
+ if FileTest.exist?("/usr/sbin/apache2")
+ true
+ else
+ ''
+ end
end
end
Facter.add("clamd") do
setcode do
- FileTest.exist?("/usr/sbin/clamd")
+ if FileTest.exist?("/usr/sbin/clamd")
+ true
+ else
+ ''
+ end
end
end
Facter.add("exim4") do
setcode do
- FileTest.exist?("/usr/sbin/exim4")
+ if FileTest.exist?("/usr/sbin/exim4")
+ true
+ else
+ ''
+ end
end
end
Facter.add("postfix") do
setcode do
- FileTest.exist?("/usr/sbin/postfix")
+ if FileTest.exist?("/usr/sbin/postfix")
+ true
+ else
+ ''
+ end
end
end
Facter.add("postgres81") do
setcode do
- FileTest.exist?("/usr/lib/postgresql/8.1/bin/postgres")
+ if FileTest.exist?("/usr/lib/postgresql/8.1/bin/postgres")
+ true
+ else
+ ''
+ end
end
end
Facter.add("postgres83") do
setcode do
- FileTest.exist?("/usr/lib/postgresql/8.3/bin/postgres")
+ if FileTest.exist?("/usr/lib/postgresql/8.3/bin/postgres")
+ true
+ else
+ ''
+ end
end
end
Facter.add("postgres84") do
setcode do
- FileTest.exist?("/usr/lib/postgresql/8.4/bin/postgres")
+ if FileTest.exist?("/usr/lib/postgresql/8.4/bin/postgres")
+ true
+ else
+ ''
+ end
end
end
Facter.add("postgres90") do
setcode do
- FileTest.exist?("/usr/lib/postgresql/9.0/bin/postgres")
+ if FileTest.exist?("/usr/lib/postgresql/9.0/bin/postgres")
+ true
+ else
+ ''
+ end
end
end
Facter.add("postgrey") do
setcode do
- FileTest.exist?("/usr/sbin/postgrey")
+ if FileTest.exist?("/usr/sbin/postgrey")
+ true
+ else
+ ''
+ end
end
end
Facter.add("greylistd") do
end
Facter.add("policydweight") do
setcode do
- FileTest.exist?("/usr/sbin/policyd-weight")
+ if FileTest.exist?("/usr/sbin/policyd-weight")
+ true
+ else
+ ''
+ end
end
end
Facter.add("vsftpd") do
setcode do
- FileTest.exist?("/usr/sbin/vsftpd")
+ if FileTest.exist?("/usr/sbin/vsftpd")
+ true
+ else
+ ''
+ end
end
end
Facter.add("spamd") do
setcode do
- FileTest.exist?("/usr/sbin/spamd")
+ if FileTest.exist?("/usr/sbin/spamd")
+ true
+ else
+ ''
+ end
end
end
Facter.add("php5") do
- setcode do
- FileTest.exist?("/usr/lib/apache2/modules/libphp5.so") or
+ php = FileTest.exist?("/usr/lib/apache2/modules/libphp5.so") or
FileTest.exist?("/usr/bin/php5") or
FileTest.exist?("/usr/bin/php5-cgi") or
FileTest.exist?("/usr/lib/cgi-bin/php5")
+ setcode do
+ if php
+ true
+ else
+ ''
+ end
end
end
Facter.add("php5suhosin") do
- setcode do
- FileTest.exist?("/usr/lib/php5/20060613/suhosin.so") or
+ suhosin=FileTest.exist?("/usr/lib/php5/20060613/suhosin.so") or
FileTest.exist?("/usr/lib/php5/20060613+lfs/suhosin.so")
+ setcode do
+ if suhosin
+ true
+ else
+ ''
+ end
end
end
Facter.add("syslogversion") do
end
Facter.add("rsyncd") do
setcode do
- FileTest.exist?("/etc/rsyncd.conf")
+ if FileTest.exist?("/etc/rsyncd.conf")
+ true
+ else
+ ''
+ end
end
end
Facter.add("unbound") do
- setcode do
- FileTest.exist?("/usr/sbin/unbound") and
+ unbound=FileTest.exist?("/usr/sbin/unbound") and
FileTest.exist?("/var/lib/unbound/root.key")
+ setcode do
+ if unbound
+ true
+ else
+ ''
+ end
end
end