From: Peter Palfrader Date: Mon, 21 Dec 2015 19:18:07 +0000 (+0100) Subject: refactor debian-org/lib/facter/paths.rb facter X-Git-Url: https://git.adam-barratt.org.uk/?a=commitdiff_plain;h=3f2300fe6fd8dbb91c842e4a3b8c58322b65ede6;p=mirror%2Fdsa-puppet.git refactor debian-org/lib/facter/paths.rb facter --- diff --git a/modules/debian-org/lib/facter/paths.rb b/modules/debian-org/lib/facter/paths.rb index b8b7b0641..9e569fb82 100644 --- a/modules/debian-org/lib/facter/paths.rb +++ b/modules/debian-org/lib/facter/paths.rb @@ -1,36 +1,15 @@ -Facter.add("has_srv_build_trees") do - setcode do - if FileTest.exist?("/srv/build-trees") - true - else - '' - end - end -end -Facter.add("has_srv_buildd") do - setcode do - if FileTest.exist?("/srv/buildd") - true - else - '' - end - end -end -Facter.add("has_srv_buildd") do - setcode do - if FileTest.exist?("/srv/buildd") - true - else - '' - end - end -end -Facter.add("has_etc_ssh_ssh_host_ed25519_key") do - setcode do - if FileTest.exist?("/etc/ssh/ssh_host_ed25519_key") - true - else - '' + +%w{/srv/build-trees + /srv/buildd + /etc/ssh/ssh_host_ed25519_key +}.each do |path| + Facter.add("has" + path.gsub('/','_')) do + setcode do + if FileTest.exist?(path) + true + else + '' + end end end end