Module: Puppet::Parser::Functions

Defined in:
vendor_modules/stdlib/lib/puppet/parser/functions/validate_x509_rsa_key_pair.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/validate_email_address.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/validate_absolute_path.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/validate_ipv6_address.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/validate_ipv4_address.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/is_function_available.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/validate_domain_name.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/load_module_metadata.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/validate_ip_address.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/join_keys_to_values.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/delete_undef_values.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/has_interface_with.rb,
modules/network/lib/puppet/parser/functions/slice_network_constants.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/validate_slength.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/validate_numeric.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/validate_integer.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/str2saltedsha512.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/str2saltedpbkdf2.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/is_email_address.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/is_absolute_path.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/validate_string.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/validate_augeas.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/is_ipv6_address.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/is_ipv4_address.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/get_module_path.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/ensure_packages.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/validate_array.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/is_mac_address.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/is_domain_name.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/has_ip_network.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/has_ip_address.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/assert_private.rb,
modules/graphite/lib/puppet/parser/functions/configparser_format.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/validate_hash.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/validate_bool.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/try_get_value.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/is_ip_address.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/delete_values.rb,
modules/mediawiki/lib/puppet/parser/functions/compile_redirects.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/validate_cmd.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/shell_escape.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/regexpescape.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/pick_default.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/intersection.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/enclose_ipv6.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/delete_regex.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/convert_base.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/validate_re.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/shell_split.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/deprecation.rb,
modules/labstore/lib/puppet/parser/functions/mount_nfs_volume.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/shell_join.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/is_numeric.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/is_integer.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/difference.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/deep_merge.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/capitalize.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/values_at.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/uriescape.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/parseyaml.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/parsejson.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/is_string.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/fqdn_uuid.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/delete_at.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/camelcase.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/any2array.rb,
modules/wmflib/lib/puppet/parser/functions/systemd_template.rb,
modules/role/lib/puppet/parser/functions/kafka_cluster_name.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/unix2dos.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/to_bytes.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/swapcase.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/str2bool.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/num2bool.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/loadyaml.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/loadjson.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/is_float.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/is_array.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/downcase.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/dos2unix.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/bool2str.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/bool2num.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/basename.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/any2bool.rb,
modules/wmflib/lib/puppet/parser/functions/ssl_ciphersuite.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/squeeze.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/shuffle.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/reverse.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/private.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/is_hash.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/is_bool.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/has_key.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/flatten.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/dirname.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/ceiling.rb,
modules/wmflib/lib/puppet/parser/functions/requires_realm.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/values.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/upcase.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/unique.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/type3x.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/suffix.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/rstrip.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/reject.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/prefix.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/member.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/lstrip.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/getvar.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/delete.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/concat.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/base64.rb,
modules/wmflib/lib/puppet/parser/functions/puppet_ssldir.rb,
modules/wmflib/lib/puppet/parser/functions/init_template.rb,
modules/service/lib/puppet/parser/functions/merge_config.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/union.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/strip.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/round.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/range.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/merge.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/floor.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/empty.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/dig44.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/count.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/clamp.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/chomp.rb,
modules/wmflib/lib/puppet/parser/functions/get_clusters.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/type.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/time.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/sort.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/size.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/pick.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/keys.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/join.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/hash.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/grep.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/glob.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/chop.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/zip.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/pry.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/min.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/max.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/dig.rb,
vendor_modules/stdlib/lib/puppet/parser/functions/abs.rb,
modules/wmflib/lib/puppet/parser/functions/cron_splay.rb,
modules/role/lib/puppet/parser/functions/kafka_config.rb,
modules/wmflib/lib/puppet/parser/functions/ipresolve.rb,
modules/wmflib/lib/puppet/parser/functions/htpasswd.rb,
modules/wmflib/lib/puppet/parser/functions/secret.rb

Overview

Function: kafka_config(string cluster_prefix[, string site])

Reworks various variables to be in a format suitable for supplying them to the kafka module classes. If the optional site argument is given, the actual site where the function is evaluated is ignored

Parameters

cluster_prefix

The full Kafka cluster name to use or its prefix, as understood by the 'kafka_cluster_name' function. This argument is interpreted as the full cluster name if the ::kafka_clusters Hiera hash contains a key with the given name. Otherwise, 'kafka_cluster_name' is invoked. Required.

site

The site for which to return the configuration. Default: $::site

Usage

$config = kafka_config($prefix)

This function retrieves the full cluster name using the given prefix (and optionally site) using the 'kafka_cluster_name' function. Then, it consults the 'kafka_clusters' and 'zookeeper_clusters' hashes in Hiera and reformats them to provide a more convenient output, suitable for usage in Puppet modules.

It returns the config for a Kafka cluster in the following format:

{
  'name'      => # full Kafka cluster name
  'brokers'   => {
    'hash'       => # original brokers definition as seen in Hiera
    'array'      => # array of brokers' FQDNs
    'string'     => # comma-separated list of host:port broker pairs
    'ssl_string' => # comma-separated list of host:ssl_port broker pairs
    'graphite'   => # comma-separated list of host_9999 broker pairs
    'size'       => # number of brokers
  }
  'jmx_port'  => # the JMX port (9999)
  'port'      => # the plaintext port (9092)
  'ssl_port'  => # the TLS/SSL port (9093)
  'zookeeper' => {
    'name'   => # Zookeeper cluster name used by this Kafka cluster
    'hosts'  => # array of defined zookeeper hosts
    'chroot' => # the zookeeper chroot for the cluster
    'url'    => # the connection string to use
  }
}

Constant Summary collapse

@@labs_nfs_config_touched =
nil
@@labs_nfs_config =
nil