Puppet Function: promtail::to_yaml

Defined in:
lib/puppet/functions/promtail/to_yaml.rb
Function type:
Ruby 4.x API

Overview

promtail::to_yaml(Hash $config_hash)String

A function to convert a hash into yaml for the promtail config

Examples:

promtail::to_yaml($promtail::config_hash)

Parameters:

  • config_hash (Hash)

    A Puppet hash to be converted into YAML

Returns:

  • (String)

    Returns the YAML version of the hash as a string



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/puppet/functions/promtail/to_yaml.rb', line 4

Puppet::Functions.create_function(:'promtail::to_yaml') do
  # @param config_hash
  #   A Puppet hash to be converted into YAML
  # @return [String]
  #   Returns the YAML version of the hash as a string
  # @example
  #   promtail::to_yaml($promtail::config_hash)
  #
  dispatch :generate_yaml do
    param 'Hash', :config_hash
    return_type 'String'
  end

  def generate_yaml(config_hash)
    config_hash.to_yaml
  end
end