]> git.donarmstrong.com Git - dsa-puppet.git/blobdiff - modules/debian-org/lib/facter/software.rb
Only sync logs once per day since we are only transferring rotated logs
[dsa-puppet.git] / modules / debian-org / lib / facter / software.rb
index 237f9fa7c63694e2520508c9d802e289f578e8a9..ba4c1be38933a0216111956aedc72c861e4e517c 100644 (file)
@@ -1,36 +1,61 @@
 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
+Facter.add("postgres") do
        setcode do
-               FileTest.exist?("/usr/lib/postgresql/8.1/bin/postgres")
-       end
-end
-Facter.add("postgres83") do
-       setcode do
-               FileTest.exist?("/usr/lib/postgresql/8.3/bin/postgres")
+               pg = (FileTest.exist?("/usr/lib/postgresql/8.1/bin/postgres") or
+               FileTest.exist?("/usr/lib/postgresql/8.3/bin/postgres") or
+               FileTest.exist?("/usr/lib/postgresql/8.4/bin/postgres") or
+               FileTest.exist?("/usr/lib/postgresql/9.0/bin/postgres") or
+               FileTest.exist?("/usr/lib/postgresql/9.1/bin/postgres") or
+               FileTest.exist?("/usr/lib/postgresql/9.2/bin/postgres"))
+               if pg
+                       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
@@ -40,46 +65,83 @@ Facter.add("greylistd") do
 end
 Facter.add("policydweight") do
        setcode do
-               FileTest.exist?("/usr/sbin/policyd-weight")
-       end
-end
-Facter.add("vsftpd") do
-       setcode do
-               FileTest.exist?("/usr/sbin/vsftpd")
+               if FileTest.exist?("/usr/sbin/policyd-weight")
+                       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")
+               FileTest.exist?("/usr/lib/cgi-bin/php5"))
+       setcode do
+               if php
+                       true
+               else
+                       ''
+               end
        end
 end
 Facter.add("php5suhosin") do
+       suhosin=(FileTest.exist?("/usr/lib/php5/20060613/suhosin.so") or
+               FileTest.exist?("/usr/lib/php5/20060613+lfs/suhosin.so"))
        setcode do
-               FileTest.exist?("/usr/lib/php5/20060613/suhosin.so") or
-               FileTest.exist?("/usr/lib/php5/20060613+lfs/suhosin.so")
+               if suhosin
+                       true
+               else
+                       ''
+               end
        end
 end
 Facter.add("syslogversion") do
        setcode do
-               %x{dpkg-query -W -f='${Version}\n' syslog-ng | cut -b1}.chomp
+               %x{dpkg-query -W -f='${Version}\n' syslog-ng | cut -b1-3}.chomp
        end
 end
-Facter.add("rsyncd") do
+Facter.add("unbound") do
+       unbound=(FileTest.exist?("/usr/sbin/unbound") and
+               FileTest.exist?("/var/lib/unbound/root.key"))
        setcode do
-               FileTest.exist?("/etc/rsyncd.conf")
+               if unbound
+                       true
+               else
+                       ''
+               end
        end
 end
-Facter.add("unbound") do
+Facter.add("munin_async") do
+       setcode do
+               FileTest.exist?("/usr/share/munin/munin-async")
+       end
+end
+Facter.add("samhain") do
+       setcode do
+               if FileTest.exist?("/usr/sbin/samhain")
+                       true
+               else
+                       ''
+               end
+       end
+end
+Facter.add("systemd") do
        setcode do
-               FileTest.exist?("/usr/sbin/unbound") and
-               FileTest.exist?("/var/lib/unbound/root.key")
+               init = '/sbin/init'
+               if File.symlink?(init) and File.readlink(init) == "/lib/systemd/systemd"
+                       true
+               else
+                       ''
+               end
        end
 end