Puppet Function: dehydrated::file
- Defined in:
-
lib/puppet/functions/dehydrated/file.rb
- Function type:
- Ruby 4.x API
Overview
dehydrated::file(String $files, Optional[String] *$more_files) ⇒ Any
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/puppet/functions/dehydrated/file.rb', line 6
Puppet::Functions.create_function(:'dehydrated::file') do
dispatch :getfile do
required_param 'String', :files
optional_repeated_param 'String', :more_files
end
def getfile(files, *more_files)
ret = nil
files = [files] + more_files
files.each do |file|
unless Puppet::Util.absolute_path?(file)
raise(Puppet::ParseError, 'Files must be fully qualified')
end
next unless File.exist?(file)
ret = if %r{.*\.ocsp$}.match?(file)
Base64.strict_encode64(File.read(file))
else
File.read(file)
end
end
ret
end
end
|