Puppet Function: clickhouse_config

Defined in:
lib/puppet/parser/functions/clickhouse_config.rb
Function type:
Ruby 3.x API

Summary

Convert hash to Clickhouse XML config.

Overview

clickhouse_config(Hash $Settings)Xml

Parameters:

  • Settings (Hash)

    for Clickhouse Server.

Returns:

  • (Xml)

    Сlickhouse XML configuration.



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

newfunction(:clickhouse_config, type: :rvalue, doc: <<-EOS
  @summary
    Convert hash to Clickhouse XML config.
  @param [Hash] Settings for Clickhouse Server.
  @return [Xml] Сlickhouse XML configuration.
  EOS
) do |args|
  if args.size != 1
    raise Puppet::ParseError, _('clickhouse_config(): Wrong number of arguments given (%{args_length} for 1)') % { args_length: args.length }
  end

  args.each do |arg|
    if arg.class != Hash
      raise Puppet::ParseError, _('clickhouse_config(): Wrong type of arguments given (%{args_class} for Hash)') % { args_class: args.class }
    end
  end

  XmlSimple.xml_out(args[0], 'RootName' => 'yandex', 'AttrPrefix' => true)
end