#855: cid:priority tag to integer

This commit is contained in:
amartynov 2015-11-06 11:55:36 +03:00
parent 034018fb42
commit 6fd7275f2e

View File

@ -32,6 +32,7 @@ class StackBootstrapWorker < Worker
unless without_bootstrap unless without_bootstrap
sorted_keys = servers_with_priority.keys.sort{|x,y| y <=> x} sorted_keys = servers_with_priority.keys.sort{|x,y| y <=> x}
sorted_keys.each do |key| sorted_keys.each do |key|
@out.puts "Servers with priority '#{key}':"
bootstrap_servers!(servers_with_priority[key], report) bootstrap_servers!(servers_with_priority[key], report)
end end
end end
@ -174,7 +175,11 @@ class StackBootstrapWorker < Worker
deploy_env = project.deploy_env(stack.deploy_env) deploy_env = project.deploy_env(stack.deploy_env)
provider = stack.provider_instance provider = stack.provider_instance
stack_servers_info = provider.stack_servers(stack).group_by{|info| info["tags"]["cid:priority"] || 0} stack_servers = provider.stack_servers(stack)
stack_servers.each do |info|
info["tags"]["cid:priority"] = info["tags"]["cid:priority"].to_i
end
stack_servers_info = stack_servers.group_by{|info| info["tags"]["cid:priority"]}
stack_servers_with_priority = {} stack_servers_with_priority = {}
stack_servers_info.each do |priority, info_array| stack_servers_info.each do |priority, info_array|
stack_servers_with_priority[priority] = info_array.map do |extended_info| stack_servers_with_priority[priority] = info_array.map do |extended_info|
@ -201,7 +206,7 @@ class StackBootstrapWorker < Worker
end end
@out.puts "Stack servers have been synced with CID" @out.puts "Stack servers have been synced with CID"
stack_servers_with_priority.each do |priority, servers| stack_servers_with_priority.each do |priority, servers|
@out.puts "Priority '#{priority}': #{servers.map(&:id).join(", ")}" @out.puts "Servers with priority '#{priority}': #{servers.map(&:id).join(", ")}"
end end
@out.flush @out.flush
stack_servers_with_priority stack_servers_with_priority