From 6bda2aad4f21dce071235673e366b45426df368d Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Thu, 20 Aug 2015 09:03:25 +0200 Subject: [PATCH] portforwarder facters --- modules/debian-org/lib/facter/roleaccounts.rb | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) 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 -- 2.20.1