fix munin 1
[mirror/dsa-puppet.git] / modules / debian-org / lib / facter / roleaccounts.rb
index c2c778b..221c376 100644 (file)
@@ -1,6 +1,17 @@
 begin
     require 'etc'
 
+    Facter.add("postgresql_key") do
+        setcode do
+            key = nil
+            keyfile = '/var/lib/postgresql/.ssh/id_rsa.pub'
+            if FileTest.exist?(keyfile)
+                key = File.open(keyfile).read.chomp
+            end
+            key
+        end
+    end
+
     Facter.add("staticsync_key") do
         setcode do
             key = nil
@@ -75,6 +86,31 @@ begin
         end
     end
 
+    Facter.add("portforwarder_key") do
+        setcode do
+            key = nil
+            keyfile = '/home/portforwarder/.ssh/id_rsa.pub'
+            if FileTest.exist?(keyfile)
+                key = File.open(keyfile).read.chomp
+            end
+            key
+        end
+    end
+
+    Facter.add("portforwarder_user_exists") do
+        setcode do
+            result = ''
+            begin
+                if Etc.getpwnam('portforwarder')
+                    result = true
+                end
+            rescue ArgumentError
+            end
+            result
+        end
+    end
+
+
 
 rescue Exception => e
 end