18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/flock_of_chefs/flocked_report.rb', line 18
def setup_dcell!
raise 'Flock of chefs cookbook not in use!' unless node[:flock_of_chefs]
if(node.recipes.include?('flock_of_chefs::keeper'))
start_args = {
:node => node.name,
:addr => "tcp://#{node[:ipaddress]}:#{node[:flock_of_chefs][:port]}"
}
case node[:flock_of_chefs][:registry][:type].to_s
when 'zk'
require 'dcell/registries/zk'
start_args.merge(
:registry => {
:adapter => 'zk',
:host => '127.0.0.1', :port => 2181
}
)
end
DCell.start(start_args)
else
keeper_node = Chef::Search::Query.new.search(:node, 'recipes:flock_of_chefs\:\:keeper').first.first
raise 'Failed to find flock keeper!' unless keeper_node
DCell.start(
:node => node.name,
:addr => "tcp://#{node[:ipaddress]}:#{node[:flock_of_chefs][:port]}",
:directory => {
:id => keeper_node.name,
:address => "tcp://#{keeper_node[:ipaddress]}:#{keeper_node[:flock_of_chefs][:port]}"
}
)
end
end
|