Puppet Function: redis_shard_hosts
- Defined in:
-
modules/redis/lib/puppet/parser/functions/redis_shard_hosts.rb
- Function type:
- Ruby 3.x API
Overview
redis_shard_hosts() ⇒ Any
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# File 'modules/redis/lib/puppet/parser/functions/redis_shard_hosts.rb', line 25
newfunction(:redis_shard_hosts, :type => :rvalue, :arity => 2) do |args|
ip = args[0]
shards = args[1]
servers = {}
my_shards = []
shards.each do |_, dc_shards|
dc_shards.each do |name, data|
if data['host'] == ip
my_shards << name
end
servers[name] ||= []
servers[name] << data['host']
end
end
my_ips = []
my_shards.each do |s|
my_ips |= servers[s]
end
my_ips.map { |h| function_ipresolve([h, 'ptr']) }.sort
end
|