Puppet Function: peadm::file_content_upload
- Defined in:
-
lib/puppet/functions/peadm/file_content_upload.rb
- Function type:
- Ruby 4.x API
Overview
peadm::file_content_upload(String[1] $content, String[1] $destination, TargetOrTargets *$targets) ⇒ Any
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/puppet/functions/peadm/file_content_upload.rb', line 5
Puppet::Functions.create_function(:'peadm::file_content_upload') do
local_types do
type 'TargetOrTargets = Variant[String[1], Target, Array[TargetOrTargets]]'
end
dispatch :file_content_upload do
param 'String[1]', :content
param 'String[1]', :destination
repeated_param 'TargetOrTargets', :targets
end
def file_content_upload(content, destination, *targets)
file = Tempfile.new('peadm')
file.write(content)
file.flush
result = call_function('upload_file', file.path, destination, *targets)
file.close
file.unlink
result
end
end
|