blob: 56556ff3767497e7b6944d231506906766929fe7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
require 'pathname'
Facter.add(:letsencrypt_bycertname) do
confine kernel: ['FreeBSD', 'Linux', 'OpenBSD']
setcode do
certs = {}
# locate the certificate repository
livedir = ['/etc/letsencrypt/live', '/etc/certbot/live']
.map { |path| Pathname.new path }
.find(&:directory?)
unless livedir.nil?
Pathname.new(livedir).children.select(&:directory?).each do |path|
m = path.basename.to_s.match(%r{(.*?)(-\d+)?$})
certs[m[1]] = path.to_s
end
end
certs
end
end
|