Puppet Function: kibana::hash2yaml
- Defined in:
-
lib/puppet/functions/kibana/hash2yaml.rb
- Function type:
- Ruby 4.x API
Summary
Converts a puppet hash to YAML string.
Overview
kibana::hash2yaml(Hash $input, Optional[Hash] $options) ⇒ String
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/puppet/functions/kibana/hash2yaml.rb', line 4
Puppet::Functions.create_function(:'kibana::hash2yaml') do
dispatch :yaml do
param 'Hash', :input
optional_param 'Hash', :options
end
require 'yaml'
def yaml(input, options = {})
settings = {
'header' => '# File managed by Puppet.'
}
settings.merge!(options)
if settings['header'].to_s.empty?
input.to_yaml
else
"#{settings['header']}\n#{input.to_yaml}"
end
end
end
|