From: Peter Palfrader Date: Thu, 20 Aug 2015 07:03:25 +0000 (+0200) Subject: portforwarder facters X-Git-Url: https://git.adam-barratt.org.uk/?a=commitdiff_plain;h=6bda2aad4f21dce071235673e366b45426df368d;p=mirror%2Fdsa-puppet.git portforwarder facters --- diff --git a/modules/debian-org/lib/facter/roleaccounts.rb b/modules/debian-org/lib/facter/roleaccounts.rb index c2c778b6c..afa6f19f1 100644 --- a/modules/debian-org/lib/facter/roleaccounts.rb +++ b/modules/debian-org/lib/facter/roleaccounts.rb @@ -75,6 +75,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