lib/ring/sqa/alarm.rb in ring-sqa-0.0.22 vs lib/ring/sqa/alarm.rb in ring-sqa-0.0.23
- old
+ new
@@ -43,12 +43,13 @@
def compose_message alarm_buffer
exceeding_nodes = alarm_buffer.exceeding_nodes
msg = {short: "#{@hostname}: raising #{@afi} alarm - #{exceeding_nodes.size} new nodes down"}
exceeding_nodes = exceeding_nodes.map { |node| @nodes.get node }
+ addr_len = @afi == 'ipv6' ? 40 : 15
nodes_list = ''
exceeding_nodes.sort_by{ |node| node[:cc] }.each do |node|
- nodes_list << "- %-35s %15s AS%-6s %2s\n" % [node[:name], node[:ip], node[:as], node[:cc]]
+ nodes_list << "- %-35s %#{addr_len}s AS%-6s %2s\n" % [node[:name], node[:ip], node[:as], node[:cc]]
end
mtr_list = ''
exceeding_nodes.sample(3).each do |node|
mtr_list << "%-35s AS%-6s (%2s)\n" % [node[:name], node[:as], node[:cc]]