Puppet Function: kafka_cluster_name

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

Overview

kafka_cluster_name()Any

Returns:

  • (Any)


32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'modules/role/lib/puppet/parser/functions/kafka_cluster_name.rb', line 32

newfunction(:kafka_cluster_name, :type => :rvalue, :arity => -2) do |args|
  # If kafka_cluster_name is set in scope in hiera, then just return it.
  name = call_function('lookup', ['kafka_cluster_name', {'default_value' => :none}])
  return name unless name == :none

  # Otherwise build name from prefix and site.
  prefix = args.shift
  site = args.shift || lookupvar('::site')
  realm = lookupvar('::realm')

  if realm == 'labs'
    labsp = lookupvar('::wmcs_project')
    "#{prefix}-#{labsp}"
  # Else expect that the caller wants the kafka cluster for prefix in the current datacenter.
  else
    "#{prefix}-#{site}"
  end
end