4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/puppet/functions/tlsinfo/lookup.rb', line 4
Puppet::Functions.create_function(:'tlsinfo::lookup') do
dispatch :lookup do
param 'String', :key
optional_param 'Boolean', :private
end
def lookup(key, private = false)
lookupkey = Puppet_X::TlsInfo.normalize(key)
if private
begin
call_function('lookup', "#{lookupkey}_private", Puppet::Pops::Types::PStringType::NON_EMPTY, 'first', nil)
rescue => detail
raise Puppet::Error, "Can not find #{lookupkey}_private in Hiera: #{detail}", detail.backtrace
end
else
begin
call_function('lookup', "#{lookupkey}_certificate", Puppet::Pops::Types::PStringType::NON_EMPTY, 'first', nil)
rescue => detail
raise Puppet::Error, "Can not find #{lookupkey}_certificate in Hiera: #{detail}", detail.backtrace
end
end
end
end
|