From 5babccf8f303e042c976541b9ad19e7f81e9b4f9 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Sat, 7 Sep 2019 17:28:44 +0200 Subject: [PATCH] unify roleaccount facter for staticsync, weblogsync, buildd, portforwarder --- modules/debian_org/lib/facter/roleaccounts.rb | 102 +----------------- 1 file changed, 1 insertion(+), 101 deletions(-) diff --git a/modules/debian_org/lib/facter/roleaccounts.rb b/modules/debian_org/lib/facter/roleaccounts.rb index fc6a620eb..46d3fb6b8 100644 --- a/modules/debian_org/lib/facter/roleaccounts.rb +++ b/modules/debian_org/lib/facter/roleaccounts.rb @@ -1,7 +1,7 @@ begin require 'etc' - %w{git postgres}.each do |user| + %w{buildd git portforwarder postgres staticsync weblogsync}.each do |user| Facter.add("#{user}_user_exists") do setcode do result = false @@ -33,106 +33,6 @@ begin end end - Facter.add("staticsync_key") do - setcode do - key = nil - keyfile = '/home/staticsync/.ssh/id_rsa.pub' - if FileTest.exist?(keyfile) - key = File.open(keyfile).read.chomp - end - key - end - end - - Facter.add("staticsync_user_exists") do - setcode do - result = false - begin - if Etc.getpwnam('staticsync') - result = true - end - rescue ArgumentError - end - result - end - end - - - Facter.add("weblogsync_key") do - setcode do - key = nil - keyfile = '/home/weblogsync/.ssh/id_rsa.pub' - if FileTest.exist?(keyfile) - key = File.open(keyfile).read.chomp - end - key - end - end - - Facter.add("weblogsync_user_exists") do - setcode do - result = false - begin - if Etc.getpwnam('weblogsync') - result = true - end - rescue ArgumentError - end - result - end - end - - - Facter.add("buildd_key") do - setcode do - key = nil - keyfile = '/home/buildd/.ssh/id_rsa.pub' - if FileTest.exist?(keyfile) - key = File.open(keyfile).read.chomp - end - key - end - end - - Facter.add("buildd_user_exists") do - setcode do - result = false - begin - if Etc.getpwnam('buildd') - result = true - end - rescue ArgumentError - end - result - 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 = false - begin - if Etc.getpwnam('portforwarder') - result = true - end - rescue ArgumentError - end - result - end - end - - - rescue Exception => e end # vim:set et: -- 2.20.1