From 6fd7275f2e04dd70dfa3d12c419df3206e70a962 Mon Sep 17 00:00:00 2001 From: amartynov Date: Fri, 6 Nov 2015 11:55:36 +0300 Subject: [PATCH] #855: cid:priority tag to integer --- devops-service/workers/stack_bootstrap_worker.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/devops-service/workers/stack_bootstrap_worker.rb b/devops-service/workers/stack_bootstrap_worker.rb index 5bfbb22..442e793 100644 --- a/devops-service/workers/stack_bootstrap_worker.rb +++ b/devops-service/workers/stack_bootstrap_worker.rb @@ -32,6 +32,7 @@ class StackBootstrapWorker < Worker unless without_bootstrap sorted_keys = servers_with_priority.keys.sort{|x,y| y <=> x} sorted_keys.each do |key| + @out.puts "Servers with priority '#{key}':" bootstrap_servers!(servers_with_priority[key], report) end end @@ -174,7 +175,11 @@ class StackBootstrapWorker < Worker deploy_env = project.deploy_env(stack.deploy_env) 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_info.each do |priority, info_array| stack_servers_with_priority[priority] = info_array.map do |extended_info| @@ -201,7 +206,7 @@ class StackBootstrapWorker < Worker end @out.puts "Stack servers have been synced with CID" 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 @out.flush stack_servers_with_priority